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