Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public TEntity SingleDb <TEntity>(LongId <TEntity> id) where TEntity : DbEntity, ILongId => SinglePrivateDb <TEntity>(id.ToLong());