Exemple #1
0
        public void Prepare()
        {
            var rowsMap = this.GetRowsMap();

            foreach (var trackAssoc in changeSet.trackAssocs)
            {
                var             assoc     = this._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);
                childNode.association = assoc;
                childNode.ParentRow   = parent;
                updateNodes.AddLast(childNode);
            }


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

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

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

                    default:
                        throw new DomainServiceException(string.Format(ErrorStrings.ERR_REC_CHANGETYPE_INVALID, dbSetInfo.EntityType.Name, rowInfo.changeType));
                    }
                }
            }
        }
Exemple #2
0
        public void Prepare()
        {
            var rowsMap = this.GetRowsMap();
       
            foreach (var trackAssoc in changeSet.trackAssocs)
            {
                var assoc = this._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);
                childNode.association = assoc;
                childNode.ParentRow = parent;
                updateNodes.AddLast(childNode);
            }


            foreach (var dbSet in this.GetSortedDbSets())
            {
                foreach (RowInfo rowInfo in dbSet.rows)
                {
                    DbSetInfo dbSetInfo = rowInfo.dbSetInfo;
                    _allList.AddLast(rowInfo);
                    switch (rowInfo.changeType)
                    {
                        case ChangeType.Added:
                            _insertList.AddLast(rowInfo);
                            break;
                        case ChangeType.Deleted:
                            _insertList.AddFirst(rowInfo);
                            break;
                        case ChangeType.Updated:
                            _updateList.AddLast(rowInfo);
                            break;
                        default:
                            throw new DomainServiceException(string.Format(ErrorStrings.ERR_REC_CHANGETYPE_INVALID, dbSetInfo.EntityType.Name, rowInfo.changeType));
                    }
                }
            }
      
        }