예제 #1
0
        public void Prepare()
        {
            Dictionary <string, RowInfo> rowsMap = GetRowsMap();

            foreach (TrackAssoc trackAssoc in ChangeSet.trackAssocs)
            {
                Association     assoc     = _metadata.Associations[trackAssoc.assocName];
                string          pkey      = string.Format("{0}:{1}", assoc.parentDbSetName, trackAssoc.parentKey);
                string          ckey      = string.Format("{0}:{1}", assoc.childDbSetName, trackAssoc.childKey);
                RowInfo         parent    = rowsMap[pkey];
                RowInfo         child     = rowsMap[ckey];
                ParentChildNode childNode = new ParentChildNode(child)
                {
                    Association = assoc,
                    ParentRow   = parent
                };
                updateNodes.AddLast(childNode);
            }


            foreach (DbSet dbSet in GetSortedDbSets())
            {
                foreach (RowInfo rowInfo in dbSet.rows)
                {
                    DbSetInfo dbSetInfo = rowInfo.GetDbSetInfo();
                    _allList.AddLast(rowInfo);
                    switch (rowInfo.changeType)
                    {
                    case ChangeType.Added:
                        _insertList.AddLast(rowInfo);
                        break;

                    case ChangeType.Updated:
                        _updateList.AddLast(rowInfo);
                        break;

                    case ChangeType.Deleted:
                        _deleteList.AddFirst(rowInfo);
                        break;

                    default:
                        throw new DomainServiceException(string.Format(ErrorStrings.ERR_REC_CHANGETYPE_INVALID,
                                                                       dbSetInfo.GetEntityType().Name, rowInfo.changeType));
                    }
                }
            }
        }
예제 #2
0
 public EntityChangeState()
 {
     ChangedFieldNames = new string[0];
     ParentRows        = new ParentChildNode[0];
 }