'Using group by in AutoMapper

Can we use group by in AutoMapper with C# and Entity Framework? Can you show an example please?

CreateMap<x, y>()
            .ForMember(destination => destination.Id)
                options => options.MapFrom(source => source.Id)
            .ForMember(destination => destination.AktifMi,
                options => options.MapFrom(source => true));

I will be glad if you apply here

var y = _context.XXX.OrderByDescending(i => i.Id);
var ca = _mapper.ProjectTo<x>(y);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source