void AddDefinition(WorkflowService workflowService) { if (workflowService == null) { throw FxTrace.Exception.ArgumentNull("workflowService"); } WorkflowIdentityKey identityKey = new WorkflowIdentityKey(workflowService.DefinitionIdentity); if (object.Equals(this.DefaultDefinitionIdentity, identityKey.Identity) || this.definitionCollection.ContainsKey(identityKey)) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.DuplicateDefinitionIdentity(identityKey.Identity == null ? "null" : identityKey.Identity.ToString()))); } if (workflowService.Name != this.defaultWorkflowService.Name) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.DifferentWorkflowServiceNameNotSupported(workflowService.Name, this.defaultWorkflowService.Name))); } this.ThrowIfNotConfigurable(); workflowService.ValidateForVersioning(this.defaultWorkflowService); this.definitionCollection.Add(identityKey, workflowService); }