/// <summary> /// Get instance of a proxy. /// </summary> /// <param name="serviceType"> /// The service type. /// </param> /// <param name="channelFactory"> /// The channel factory. /// </param> /// <returns> /// The proxy object. /// </returns> protected object InstantinateProxy(Type serviceType, Type channelFactory) { Type type; lock (ServicesToContracts) { type = ServicesToContracts[serviceType]; } this.RegisterProxyFactory(type, serviceType, channelFactory); IActivator activator = new SessionActivator(); object[] customAttributes = serviceType.GetCustomAttributes(typeof(ServiceBehaviorAttribute), false); if (customAttributes.Length > 0) { var attribute = (ServiceBehaviorAttribute)customAttributes[0]; if (attribute.InstanceContextMode == InstanceContextMode.Single) { activator = new ApplicationActivator(); } else if (attribute.InstanceContextMode == InstanceContextMode.PerCall) { activator = new RequestActivator(); } } return(activator.Activate(type)); }
public void Run() { var activator = new SessionActivator(new Session( Modes.Select((mode) => new Stage(mode)).ToArray() )); activator.Run(); }