Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5706 for trunk


Ignore:
Timestamp:
03/16/11 13:27:30 (14 years ago)
Author:
cneumuel
Message:

#1298

  • removed Disposable
Location:
trunk/sources/HeuristicLab.Clients.Common/3.3
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Common/3.3/ClientFactory.cs

    r5701 r5706  
    2424using System.ServiceModel.Description;
    2525using HeuristicLab.Clients.Common.Properties;
    26 using HeuristicLab.Common;
    2726
    2827namespace HeuristicLab.Clients.Common {
     
    6665
    6766    #region CreateChannelFactory Methods
    68     public static Disposable<ChannelFactory<I>> CreateChannelFactory<I>(string endpointConfigurationName)
     67    public static ChannelFactory<I> CreateChannelFactory<I>(string endpointConfigurationName)
    6968      where I : class {
    7069      return CreateChannelFactory<I>(endpointConfigurationName, null);
    7170    }
    72     public static Disposable<ChannelFactory<I>> CreateChannelFactory<I>(string endpointConfigurationName, string remoteAddress)
     71    public static ChannelFactory<I> CreateChannelFactory<I>(string endpointConfigurationName, string remoteAddress)
    7372      where I : class {
    7473      return CreateChannelFactory<I>(endpointConfigurationName, remoteAddress, Settings.Default.UserName, Settings.Default.Password);
    7574    }
    76     public static Disposable<ChannelFactory<I>> CreateChannelFactory<I>(string endpointConfigurationName, string remoteAddress, string userName, string password)
     75    public static ChannelFactory<I> CreateChannelFactory<I>(string endpointConfigurationName, string remoteAddress, string userName, string password)
    7776      where I : class {
    7877      ChannelFactory<I> channelFactory = new ChannelFactory<I>(endpointConfigurationName);
    79       channelFactory.Credentials.UserName.UserName = userName;
    80       channelFactory.Credentials.UserName.Password = password;
    81       channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
    82 
    8378      if (!string.IsNullOrEmpty(remoteAddress)) {
    8479        SetEndpointAddress(channelFactory.Endpoint, remoteAddress);
    8580      }
    8681
    87       Disposable<ChannelFactory<I>> disposableChannelFactory = new Disposable<ChannelFactory<I>>(channelFactory);
    88       disposableChannelFactory.OnDisposing += new EventHandler<EventArgs<object>>(DisposableChannelFactory_OnDisposing);
    89       return disposableChannelFactory;
    90     }
    91 
    92     private static void DisposableChannelFactory_OnDisposing(object sender, EventArgs<object> e) {
    93       DisposeCommunicationObject((ICommunicationObject)e.Value);
    94       ((Disposable)sender).OnDisposing -= new EventHandler<EventArgs<object>>(DisposableChannelFactory_OnDisposing);
     82      channelFactory.Credentials.UserName.UserName = userName;
     83      channelFactory.Credentials.UserName.Password = password;
     84      channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
     85      return channelFactory;
    9586    }
    9687    #endregion
    97 
    98     public static void DisposeCommunicationObject(ICommunicationObject obj) {
    99       if (obj != null) {
    100         if (obj.State != CommunicationState.Faulted && obj.State != CommunicationState.Closed) {
    101           try { obj.Close(); }
    102           catch { obj.Abort(); }
    103         } else {
    104           obj.Abort();
    105         }
    106       }
    107     }
    10888
    10989    #region Helpers
  • trunk/sources/HeuristicLab.Clients.Common/3.3/HeuristicLab.Clients.Common-3.3.csproj

    r5163 r5706  
    1212    <AssemblyName>HeuristicLab.Clients.Common-3.3</AssemblyName>
    1313    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    14     <TargetFrameworkProfile></TargetFrameworkProfile>
     14    <TargetFrameworkProfile>
     15    </TargetFrameworkProfile>
    1516    <FileAlignment>512</FileAlignment>
    1617    <TargetFrameworkProfile />
     
    116117  <ItemGroup>
    117118    <Compile Include="ClientFactory.cs" />
    118     <Compile Include="Disposable.cs" />
    119119    <Compile Include="HeuristicLabClientsCommonPlugin.cs" />
    120120    <Compile Include="PasswordDialog.cs">
Note: See TracChangeset for help on using the changeset viewer.