public TEntity SingleOrDefaultDb <TEntity>(LongId <TEntity> id) where TEntity : DbEntity, ILongId { TEntity result; if (!loadedEntityCache.TryGet("Id", id.ToLong(), out result)) { result = LoadWhere <TEntity>("Id = @0", id.ToLong()).SingleOrDefault(); return((TEntity)loadedEntityCache.GetOrAdd(typeof(TEntity), "Id", id.ToLong(), result)); } return(result); }
public TEntity SingleDb <TEntity>(LongId <TEntity> id) where TEntity : DbEntity, ILongId => SinglePrivateDb <TEntity>(id.ToLong());