Example #1
0
 protected virtual void TrackChangesToEntity(RowInfo rowInfo)
 {
     if (!rowInfo.dbSetInfo.isTrackChanges)
     {
         return;
     }
     try
     {
         string diffgram = DiffGram.GetDiffGram(rowInfo.changeState.OriginalEntity, rowInfo.changeState.Entity, rowInfo.dbSetInfo.EntityType, rowInfo.changeState.NamesOfChangedFields);
         this.OnTrackChange(rowInfo.dbSetInfo.dbSetName, rowInfo.changeType, diffgram);
     }
     catch (Exception ex)
     {
         this.OnError(ex);
     }
 }
        protected virtual void TrackChangesToEntity(RowInfo rowInfo)
        {
            if (!rowInfo.dbSetInfo.isTrackChanges)
            {
                return;
            }

            try
            {
                string[] changed  = rowInfo.changeType == ChangeType.Deleted ? rowInfo.dbSetInfo.GetNames().Select(f => f.n).ToArray() : rowInfo.changeState.NamesOfChangedFields;
                var      diffgram = DiffGram.GetDiffGram(rowInfo.changeState.OriginalEntity,
                                                         rowInfo.changeType == ChangeType.Deleted ? null : rowInfo.changeState.Entity,
                                                         rowInfo.dbSetInfo.EntityType,
                                                         changed);
                OnTrackChange(rowInfo.dbSetInfo.dbSetName, rowInfo.changeType, diffgram);
            }
            catch (Exception ex)
            {
                _OnError(ex);
            }
        }
Example #3
0
        protected virtual void TrackChangesToEntity(RowInfo rowInfo)
        {
            DbSetInfo dbSetInfo = rowInfo.GetDbSetInfo();

            if (!dbSetInfo.GetIsTrackChanges())
            {
                return;
            }

            try
            {
                string[] changed = new string[0];
                switch (rowInfo.changeType)
                {
                case ChangeType.Updated:
                {
                    changed = rowInfo.GetChangeState().ChangedFieldNames;
                }
                break;

                default:
                {
                    changed = dbSetInfo.GetNames().Select(f => f.n).ToArray();
                }
                break;
                }

                string[] pknames  = dbSetInfo.GetPKFields().Select(f => f.fieldName).ToArray();
                string   diffgram = DiffGram.GetDiffGram(rowInfo.GetChangeState().OriginalEntity,
                                                         rowInfo.changeType == ChangeType.Deleted ? null : rowInfo.GetChangeState().Entity,
                                                         dbSetInfo.GetEntityType(), changed, pknames, rowInfo.changeType, dbSetInfo.dbSetName);

                OnTrackChange(dbSetInfo.dbSetName, rowInfo.changeType, diffgram);
            }
            catch (Exception ex)
            {
                _OnError(ex);
            }
        }