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

                return(query.FirstOrDefault());
            }
        }