protected override IConfigurable PrepareDataObject() { DeliveryAgentConnector deliveryAgentConnector = (DeliveryAgentConnector)base.PrepareDataObject(); if (!MultiValuedPropertyBase.IsNullOrEmpty(this.SourceTransportServers)) { deliveryAgentConnector.SourceTransportServers = base.ResolveIdParameterCollection <ServerIdParameter, Server, ADObjectId>(this.SourceTransportServers, base.DataSession, this.RootId, null, (ExchangeErrorCategory)0, new Func <IIdentityParameter, LocalizedString>(Strings.ErrorServerNotFound), new Func <IIdentityParameter, LocalizedString>(Strings.ErrorServerNotUnique), null, null); } else { Server server = null; try { server = ((ITopologyConfigurationSession)base.DataSession).ReadLocalServer(); } catch (TransientException exception) { base.WriteError(exception, ErrorCategory.ResourceUnavailable, this.DataObject); } if (server != null && server.IsHubTransportServer && server.IsExchange2007OrLater) { deliveryAgentConnector.SourceTransportServers = new MultiValuedProperty <ADObjectId>(false, SendConnectorSchema.SourceTransportServers, new ADObjectId[] { server.Id }); } } if (!MultiValuedPropertyBase.IsNullOrEmpty(deliveryAgentConnector.SourceTransportServers)) { ManageSendConnectors.SetConnectorHomeMta(deliveryAgentConnector, (IConfigurationSession)base.DataSession); } ManageSendConnectors.SetConnectorId(deliveryAgentConnector, ((ITopologyConfigurationSession)base.DataSession).GetRoutingGroupId()); return(deliveryAgentConnector); }
protected override IConfigurable PrepareDataObject() { SmtpSendConnectorConfig smtpSendConnectorConfig = (SmtpSendConnectorConfig)base.PrepareDataObject(); try { this.localServer = ((ITopologyConfigurationSession)base.DataSession).ReadLocalServer(); } catch (TransientException exception) { base.WriteError(exception, ErrorCategory.ResourceUnavailable, this.DataObject); } this.isHubTransportServer = (this.localServer != null && this.localServer.IsHubTransportServer); bool isEdgeConnector = this.localServer != null && this.localServer.IsEdgeServer; if (this.SourceTransportServers != null) { smtpSendConnectorConfig.SourceTransportServers = base.ResolveIdParameterCollection <ServerIdParameter, Server, ADObjectId>(this.SourceTransportServers, base.DataSession, this.RootId, null, (ExchangeErrorCategory)0, new Func <IIdentityParameter, LocalizedString>(Strings.ErrorServerNotFound), new Func <IIdentityParameter, LocalizedString>(Strings.ErrorServerNotUnique), null, delegate(IConfigurable configObject) { Server server = (Server)configObject; isEdgeConnector |= server.IsEdgeServer; return(server); }); } MultiValuedProperty <ADObjectId> multiValuedProperty = this.DataObject.SourceTransportServers; if (this.localServer != null && this.localServer.IsHubTransportServer && (multiValuedProperty == null || multiValuedProperty.Count == 0)) { multiValuedProperty = new MultiValuedProperty <ADObjectId>(false, SendConnectorSchema.SourceTransportServers, new ADObjectId[] { this.localServer.Id }); this.DataObject.SourceTransportServers = multiValuedProperty; } if (multiValuedProperty != null && multiValuedProperty.Count > 0) { ManageSendConnectors.SetConnectorHomeMta(this.DataObject, (IConfigurationSession)base.DataSession); } if (!this.DataObject.IsModified(SendConnectorSchema.MaxMessageSize)) { if (this.IsUsageSet && this.usage == NewSendConnector.UsageType.Internal) { this.MaxMessageSize = Unlimited <ByteQuantifiedSize> .UnlimitedValue; } else { this.MaxMessageSize = ByteQuantifiedSize.FromMB(35UL); } } if (!this.DataObject.IsModified(SmtpSendConnectorConfigSchema.UseExternalDNSServersEnabled) && isEdgeConnector) { this.UseExternalDNSServersEnabled = true; } ManageSendConnectors.SetConnectorId(smtpSendConnectorConfig, ((ITopologyConfigurationSession)base.DataSession).GetRoutingGroupId()); return(smtpSendConnectorConfig); }