Exemple #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);
        }
Exemple #2
0
        public static bool TryParse(string s, out LongId <TILongId> result)
        {
            long i;

            if (long.TryParse(s, out i))
            {
                result = new LongId <TILongId>(i);
                return(true);
            }

            result = new LongId <TILongId>(0);
            return(false);
        }
Exemple #3
0
 public int CompareTo(LongId <TILongId> other)
 {
     return(rawId.CompareTo(other.rawId));
 }
Exemple #4
0
 public bool Equals(LongId <TILongId> other)
 {
     return(other.rawId == rawId);
 }
Exemple #5
0
 public TEntity SingleDb <TEntity>(LongId <TEntity> id) where TEntity : DbEntity, ILongId => SinglePrivateDb <TEntity>(id.ToLong());