예제 #1
0
 public T GetByPK(K key)
 {
     using (var context = DbContextCreator.Context())
     {
         return(context.Set <T>()
                .Where(IsKey(key))
                .FirstOrDefault());
     }
 }
예제 #2
0
        public K GetMaxKey()
        {
            using (var context = DbContextCreator.Context())
            {
                var query = context.Set <T>()
                            .OrderByDescending(KeySelector)
                            .Select(KeySelector);

                return(query.FirstOrDefault());
            }
        }