コード例 #1
0
        internal static ComProxy Create(IntPtr outer, IProvideChannelBuilderSettings channelBuilderSettings)
        {

            if (channelBuilderSettings == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.CannotCreateChannelOption)));


            ChannelCredentials ChannelCredentials = null;
            ComProxy proxy = null;
            try
            {
                ChannelCredentials = new ChannelCredentials(channelBuilderSettings);
                proxy = ComProxy.Create(outer, ChannelCredentials, ChannelCredentials);
                return proxy;
            }
            finally
            {
                if (proxy == null)
                {
                    if (ChannelCredentials != null)
                        ((IDisposable)ChannelCredentials).Dispose();
                }

            }
        }
コード例 #2
0
 ComProxy GenerateIntrinsic(IntPtr outerProxy, ref Guid riid)
 {
     if (proxyCreator.SupportsIntrinsics())
     {
         if (riid == typeof(IChannelOptions).GUID)
         {
             return(ChannelOptions.Create(outerProxy, proxyCreator as IProvideChannelBuilderSettings));
         }
         else if (riid == typeof(IChannelCredentials).GUID)
         {
             return(ChannelCredentials.Create(outerProxy, proxyCreator as IProvideChannelBuilderSettings));
         }
         else
         {
             throw Fx.AssertAndThrow("Given IID is not an intrinsic");
         }
     }
     else
     {
         throw Fx.AssertAndThrow("proxyCreator does not support intrinsic");
     }
 }
 internal static ComProxy Create(IntPtr outer, IProvideChannelBuilderSettings channelBuilderSettings)
 {
     ComProxy proxy2;
     if (channelBuilderSettings == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("CannotCreateChannelOption")));
     }
     ChannelCredentials credentials = null;
     ComProxy proxy = null;
     try
     {
         credentials = new ChannelCredentials(channelBuilderSettings);
         proxy = ComProxy.Create(outer, credentials, credentials);
         proxy2 = proxy;
     }
     finally
     {
         if ((proxy == null) && (credentials != null))
         {
             ((IDisposable) credentials).Dispose();
         }
     }
     return proxy2;
 }