Beispiel #1
0
 private void CreateNewServiceChannel()
 {
     this.ChannelFactory.Faulted += new EventHandler(this.Factory_Faulted);
     this.ChannelFactory.Opened  += new EventHandler(this.Factory_Opened);
     this.ChannelFactory.Closed  += new EventHandler(this.Factory_Closed);
     //this.ChannelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
     this._serviceChannel         = /*this.SecurityTokenResponse == null || this.SecurityTokenResponse.Token == null ?*/ new Microsoft.Xrm.Sdk.Client.ServiceChannel <TService>(this.ChannelFactory) /*: (Microsoft.Xrm.Sdk.Client.ServiceChannel<TService>)new ServiceFederatedChannel<TService>(this.ChannelFactory, this.SecurityTokenResponse.Token)*/;
     this._serviceChannel.Timeout = this.Timeout;
 }
Beispiel #2
0
 /// <summary>Custom implementation of Dispose that disposes the service channel and channel factory.</summary>
 /// <param name="disposing">Type: Returns_Boolean. </param>
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
     {
         return;
     }
     this.DisposeFactory(disposing);
     if (this._serviceChannel != null)
     {
         this._serviceChannel.Dispose();
     }
     this._serviceChannel = (Microsoft.Xrm.Sdk.Client.ServiceChannel <TService>)null;
 }
Beispiel #3
0
 /// <summary>Closes the service channel and channel factory if they are open, and then invokes <see cref="M:Microsoft.Xrm.Sdk.Client.ServiceProxy`1.AuthenticateCore"></see>.</summary>
 public void Authenticate()
 {
     if (this._serviceChannel != null)
     {
         this._serviceChannel.Close();
         this._serviceChannel.Dispose();
         this._serviceChannel = (Microsoft.Xrm.Sdk.Client.ServiceChannel <TService>)null;
     }
     if (this._channelFactory != null)
     {
         this.RemoveChannelFactoryEvents();
         this._channelFactory.Close(true);
         this._channelFactory = (System.ServiceModel.ChannelFactory <TService>)null;
     }
     this.AuthenticateCore();
 }