示例#1
0
        public virtual int Create(TEntity newEntity)
        {
            var dbEntity = GetEntity(newEntity);

            dbEntity.State = EntityState.Added;

            Db.SaveChanges();

            return(newEntity.Id);
        }
示例#2
0
        public virtual int Create(TEntity newEntity)
        {
            var dbEntity = GetEntity(newEntity);

            dbEntity.State = EntityState.Added;

            Db.SaveChanges();

            var id = newEntity.Id;

            Cache?.Add($"{SingleCacheKeyPrefix}:{id}", JsonConvert.SerializeObject(newEntity));

            return(id);
        }