/// <summary> /// The create service host. /// </summary> /// <param name="serviceType"> /// The service type. /// </param> /// <param name="baseAddresses"> /// The base addresses. /// </param> /// <returns> /// The <see cref="ServiceHost"/>. /// </returns> protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) { if (serviceType == typeof(SubscriptionLookupService)) { var serviceSettings = new LookupServiceSettings { MdmApplicationId = this.mdmApplicationId, PublicationId = this.publicationId, PublicationDescription = this.publicationDescription, PublicationName = this.publicationName, PublicationOptinLink = this.publicationOptinLink }; return(new LookupServiceHost(this.usersDal, serviceSettings, serviceType, baseAddresses)); } if (serviceType == typeof(UnsubscribeService)) { var serviceSettings = new UnsubscribeServiceSettings { MdmApplicationId = this.mdmApplicationId }; return(new UnsubscribeServiceHost(this.hcpCommandsQueue, serviceSettings, serviceType, baseAddresses)); } if (serviceType == typeof(SuppressUserService)) { return(new SuppressUserServiceHost(this.hcpCommandsQueue, serviceType, baseAddresses)); } string errorMsg = string.Format("service type: {0} is unknown service type", serviceType.FullName); Log.Error(errorMsg); throw new ArgumentException(errorMsg, "serviceType"); }
/// <summary> /// Initializes a new instance of the <see cref="LookupServiceHost"/> class. /// </summary> /// <param name="usersDal"> /// The users dal. /// </param> /// <param name="lookupServiceSettings"> /// The lookup service settings. /// </param> /// <param name="serviceType"> /// The service type. /// </param> /// <param name="baseAddresses"> /// The base addresses. /// </param> public LookupServiceHost(IUsersDal usersDal, LookupServiceSettings lookupServiceSettings, Type serviceType, params Uri[] baseAddresses) : base(serviceType, baseAddresses) { if (usersDal == null) { throw new ArgumentNullException("usersDal"); } if (lookupServiceSettings == null) { throw new ArgumentNullException("lookupServiceSettings"); } foreach (ContractDescription cd in this.ImplementedContracts.Values) { cd.Behaviors.Add(new LookupServiceInstanceProvider(usersDal, lookupServiceSettings)); } this.Description.Behaviors.Find <ServiceBehaviorAttribute>().InstanceContextMode = InstanceContextMode.Single; }