Пример #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (RFService != null)
                    {
                        ((ICommunicationObject)RFService).Close();
                        RFService = null;
                    }
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
Пример #2
0
 public RFServiceClient()
 {
     try
     {
         var binding        = new System.ServiceModel.NetNamedPipeBinding("riffBinding");
         var uri            = RFSettings.GetAppSetting("RFServiceUri");
         var endpoint       = new System.ServiceModel.EndpointAddress(uri);
         var channelFactory = new ChannelFactory <IRFService>(binding, endpoint);
         RFService = channelFactory.CreateChannel();
     }
     catch
     {
         if (RFService != null)
         {
             ((ICommunicationObject)RFService).Abort();
         }
         throw;
     }
 }