void OnSubmitBulkOperationCompleted(object sender, Service.BOCCompletedEventArgs e) { if (e.UserState != this) { // This event is for a different object so don't execute. return; } TransactionStatus = ServerStatus.TransactionReceived; // The following lines must be done so that the transaction isn't executed again. ServiceProxy.BOCCompleted -= OnSubmitBulkOperationCompleted; if (e.Error != null) { TransactionStatus = ServerStatus.TransactionFailed; if (InternalTransactionFailed != null) { InternalTransactionFailed(this, e); } return; } OriginChain.FillBulkOperations(e.DecompressedResult); Service.OPS newBulkOperationsSet = new Service.OPS(); newBulkOperationsSet.O = new System.Collections.ObjectModel.ObservableCollection <object>(); ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor; if (!_onCompletedBound) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; _onCompletedBound = true; } TransactionStatus = ServerStatus.TransactionExecuting; DebugLogger.Instance.LogMsg("Executing add relationship transaction. ResponseParameter Id - '{0}'; ClientId - '{1}';", ResponseParameter.I, CreateInProcessObjects().ClientId); executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref newBulkOperationsSet); }
void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, Service.TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations) { SessionId = sessionId; ServiceProxy = serviceProxy; ResponseParameter = new Service.MP(); ResponseParameter.I = Guid.NewGuid(); ResponseParameter.S = sessionId; ResponseParameter.V = Guid.Empty; ResponseParameter.D = true; ResponseParameter.T = Service.MapParameterType.Node; Service.BMA metadataBulkOperation = new Service.BMA(); metadataBulkOperation.I = TransactionLinkId; metadataBulkOperation.D = DomainParameter.GetParameterValue(sessionId); metadataBulkOperation.RM = RootMapParameter.GetParameterValue(sessionId); metadataBulkOperation.N = NodeParameter.GetParameterValue(sessionId); metadataBulkOperation.R = RelationshipParameter.GetParameterValue(sessionId); metadataBulkOperation.DT = MapManager.ConnectionTypes.ConvertProxyToService(ConnectionType); metadataBulkOperation.T = MapManager.MetadataTypes.ConvertProxyToService(MetadataType); metadataBulkOperation.MN = Name; metadataBulkOperation.MV = Value; metadataBulkOperation.RI = ResponseParameter.I; bulkOperations.O.Add(metadataBulkOperation); ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor; if (executor == null) { DebugLogger.Instance.LogMsg("Exception: This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); } if (bulkOperations.O.Count < 200) { if (!_onCompletedBound) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; _onCompletedBound = true; } DebugLogger.Instance.LogMsg("Executing add metadata transaction. Name - '{0}'; Value - '{1}';", Name, Value); executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref bulkOperations); } else { ServiceProxy.BOCCompleted += new EventHandler <Service.BOCCompletedEventArgs>(OnSubmitBulkOperationCompleted); ServiceProxy.SubmitBulkOperationsAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), SessionId, bulkOperations, this); } }
void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, Service.TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations) { TransactionStatus = ServerStatus.SendingTransaction; SessionId = sessionId; ServiceProxy = serviceProxy; Dictionary <Service.DT, Service.MP> nodeConnections = new Dictionary <Service.DT, Service.MP>(); foreach (KeyValuePair <Service.DT, SoapTransactionLinkParameter> keyValuePair in TransactionLinkConnections) { Service.DT descriptorType = keyValuePair.Key; Service.MP parameter = keyValuePair.Value.GetParameterValue(sessionId); nodeConnections[descriptorType] = parameter; } ResponseParameter = new Service.MP(); ResponseParameter.I = Guid.NewGuid(); ResponseParameter.S = sessionId; ResponseParameter.V = Guid.Empty; ResponseParameter.D = true; ResponseParameter.T = Service.MapParameterType.Node; Service.BRA relationshipBulkOperation = new Service.BRA(); relationshipBulkOperation.I = TransactionLinkId; relationshipBulkOperation.D = DomainParameter.GetParameterValue(sessionId); relationshipBulkOperation.RM = RootMapParameter.GetParameterValue(sessionId); relationshipBulkOperation.N = nodeConnections; relationshipBulkOperation.T = MapManager.RelationshipTypes.ConvertProxyToService(RelationshipType); relationshipBulkOperation.O = OriginalId; relationshipBulkOperation.RI = ResponseParameter.I; bulkOperations.O.Add(relationshipBulkOperation); ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor; if (executor == null) { DebugLogger.Instance.LogMsg("Exception: This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); } if (bulkOperations.O.Count < 200) { TransactionStatus = ServerStatus.TransactionReceived; if (!_onCompletedBound) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; _onCompletedBound = true; } TransactionStatus = ServerStatus.TransactionExecuting; DebugLogger.Instance.LogMsg("Executing add relationship transaction. ClientId - '{0}';", CreateInProcessObjects().ClientId); executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref bulkOperations); } else { ServiceProxy.BOCCompleted += new EventHandler <Service.BOCCompletedEventArgs>(OnSubmitBulkOperationCompleted); ServiceProxy.SubmitBulkOperationsAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), SessionId, bulkOperations, this); } }
void OnSubmitBulkOperationCompleted(object sender, Service.BOCCompletedEventArgs e) { if (e.UserState != this) { // This event is for a different object so don't execute. return; } // The following lines must be done so that the transaction isn't executed again. ServiceProxy.BOCCompleted -= OnSubmitBulkOperationCompleted; if (e.Error != null) { TransactionStatus = ServerStatus.TransactionFailed; if (InternalTransactionFailed != null) { InternalTransactionFailed(this, e); } return; } OriginChain.FillBulkOperations(e.DecompressedResult); Service.OPS newBulkOperationsSet = new Service.OPS(); newBulkOperationsSet.O = new System.Collections.ObjectModel.ObservableCollection<object>(); ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor; if (!_onCompletedBound) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; _onCompletedBound = true; } DebugLogger.Instance.LogMsg("Executing add metadata transaction. ResponseParameter Id - '{0}'; Name - '{1}'; Value - '{2}';", ResponseParameter.I, Name, Value); executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref newBulkOperationsSet); }