示例#1
0
        private void SetInsertAudit <T>(T item, DbEntity dbEntity, Guid actedBy) where T : class, IDbEntity, IDbModel, new()
        {
            if (dbEntity.IsNewSequentialPrimaryKey && item.GetPrimaryKey() == Guid.Empty)
            {
                item.SetPrimaryKey(Guid.NewGuid());
            }

            item.HashValue   = HashValueHelper.Generate <T>(item);
            item.CreatedBy   = actedBy;
            item.CreatedDate = DateTimeHelper.Now();
        }
示例#2
0
        public void Update <T>(T item, Guid actedBy) where T : class, IDbEntity, IDbModel, new()
        {
            Initialize();
            SetUpdateAudit <T>(item, actedBy);

            if (HashValueHelper.HasChanged(this.masterConn, this.masterTran, item))
            {
                this.GetMapper().Update <T>(item);
                this.GetLogger().Add <T>(item, ActionType.Update);
            }
        }
示例#3
0
 private void SetUpdateAudit <T>(T item, Guid actedBy) where T : class, IDbEntity, IDbModel, new()
 {
     item.HashValue   = HashValueHelper.Generate <T>(item);
     item.UpdatedBy   = actedBy;
     item.UpdatedDate = DateTimeHelper.Now();
 }