Example #1
0
        public IQueryable <Core.Data.Bonus> GetCurrentVersionBonuses()
        {
            var currentIdVersion = Bonuses
                                   .GroupBy(bonus => bonus.Id)
                                   .Select(group => new { Id = group.Key, Version = group.Max(obj => obj.Version) });

            return(Bonuses
                   .Include(bonus => bonus.Statistic)
                   .Where(bonus => currentIdVersion.Contains(new { bonus.Id, bonus.Version })));
        }