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 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); }
public int CompareTo(LongId <TILongId> other) { return(rawId.CompareTo(other.rawId)); }
public bool Equals(LongId <TILongId> other) { return(other.rawId == rawId); }
public TEntity SingleDb <TEntity>(LongId <TEntity> id) where TEntity : DbEntity, ILongId => SinglePrivateDb <TEntity>(id.ToLong());