protected override IAsyncResult OnBeginCreateInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, object loadingContext, TimeSpan timeout, AsyncCallback callback, object state) { Uri uri = new Uri(key); EndpointAddress endpointAddress = new EndpointAddress(uri, SbmpProtocolDefaults.GetEndpointIdentity(uri), new AddressHeader[0]); IChannelFactory <IRequestSessionChannel> channelFactory = this.defaultChannelFactory; if (!this.clientMode && loadingContext != null && loadingContext is bool && (bool)loadingContext) { channelFactory = this.securedChannelFactory; } IRequestSessionChannel requestSessionChannel = channelFactory.CreateChannel(endpointAddress); requestSessionChannel.SafeAddFaulted((object s, EventArgs e) => { this.RaiseNotifyCleanup(uri); try { base.BeginUnloadInstance(key, null, true, TimeSpan.FromSeconds(10), new AsyncCallback(ContainerChannelManager.UnloadCallback), this); } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteExceptionAsWarning(exception.ToString())); } }); return(new CompletedAsyncResult <IRequestSessionChannel>(requestSessionChannel, callback, state)); }
protected override void OnAbortInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, IRequestSessionChannel instance, object unloadingContext) { instance.Abort(); }
protected override void OnOpenInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, IRequestSessionChannel instance, TimeSpan timeout) { (new ContainerChannelManager.OpenInstanceAsyncResult(key, instance, timeout, null, null)).RunSynchronously(); }
protected override IRequestSessionChannel OnCreateInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, object loadingContext, TimeSpan timeout) { IAsyncResult asyncResult = this.OnBeginCreateInstance(singletonContext, key, loadingContext, timeout, null, null); return(this.OnEndCreateInstance(asyncResult)); }
protected override IAsyncResult OnBeginOpenInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, IRequestSessionChannel instance, TimeSpan timeout, AsyncCallback callback, object state) { return((new ContainerChannelManager.OpenInstanceAsyncResult(key, instance, timeout, callback, state)).Start()); }