internal static ComProxy Create(IntPtr outer, ContractDescription contract, IProvideChannelBuilderSettings channelBuilderSettings)
        {
            DispatchProxy proxy    = null;
            IntPtr        inner    = IntPtr.Zero;
            ComProxy      comProxy = null;

            try
            {
                proxy    = new DispatchProxy(contract, channelBuilderSettings);
                inner    = OuterProxyWrapper.CreateDispatchProxy(outer, proxy);
                comProxy = new ComProxy(inner, proxy);
                return(comProxy);
            }
            finally
            {
                if (comProxy == null)
                {
                    if (proxy != null)
                    {
                        ((IDisposable)proxy).Dispose();
                    }
                    if (inner != IntPtr.Zero)
                    {
                        Marshal.Release(inner);
                    }
                }
            }
        }
Example #2
0
        internal static ComProxy Create(IntPtr outer, ContractDescription contract, IProvideChannelBuilderSettings channelBuilderSettings)
        {
            DispatchProxy proxy = null;
            ComProxy      proxy3;
            IntPtr        zero   = IntPtr.Zero;
            ComProxy      proxy2 = null;

            try
            {
                proxy  = new DispatchProxy(contract, channelBuilderSettings);
                zero   = OuterProxyWrapper.CreateDispatchProxy(outer, proxy);
                proxy2 = new ComProxy(zero, proxy);
                proxy3 = proxy2;
            }
            finally
            {
                if (proxy2 == null)
                {
                    if (proxy != null)
                    {
                        ((IDisposable)proxy).Dispose();
                    }
                    if (zero != IntPtr.Zero)
                    {
                        Marshal.Release(zero);
                    }
                }
            }
            return(proxy3);
        }
        internal static void Build(Dictionary <MonikerHelper.MonikerAttribute, string> propertyTable, ref Guid riid, IntPtr ppv)
        {
            string str;

            if (IntPtr.Zero == ppv)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("ppv");
            }
            Marshal.WriteIntPtr(ppv, IntPtr.Zero);
            IProxyCreator proxyCreator = null;

            if (propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Wsdl, out str))
            {
                proxyCreator = new WsdlServiceChannelBuilder(propertyTable);
            }
            else if (propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.MexAddress, out str))
            {
                proxyCreator = new MexServiceChannelBuilder(propertyTable);
            }
            else
            {
                proxyCreator = new TypedServiceChannelBuilder(propertyTable);
            }
            IProxyManager proxyManager = new ProxyManager(proxyCreator);

            Marshal.WriteIntPtr(ppv, OuterProxyWrapper.CreateOuterProxyInstance(proxyManager, ref riid));
        }
        public static IntPtr CreateTransactionProxyTearOff(TransactionProxy txProxy)
        {
            IProxyCreator proxyCreator = new TransactionProxyBuilder(txProxy);
            IProxyManager proxyManager = new ProxyManager(proxyCreator);
            Guid          gUID         = typeof(ITransactionProxy).GUID;

            return(OuterProxyWrapper.CreateOuterProxyInstance(proxyManager, ref gUID));
        }
        public static MarshalByRefObject CreateMonikerInstance()
        {
            IProxyCreator      proxyCreator = new MonikerBuilder();
            IProxyManager      proxyManager = new ProxyManager(proxyCreator);
            Guid               gUID         = typeof(IMoniker).GUID;
            IntPtr             punk         = OuterProxyWrapper.CreateOuterProxyInstance(proxyManager, ref gUID);
            MarshalByRefObject obj2         = EnterpriseServicesHelper.WrapIUnknownWithComObject(punk) as MarshalByRefObject;

            Marshal.Release(punk);
            return(obj2);
        }
Example #6
0
        public static MarshalByRefObject CreateMonikerInstance()
        {
            IProxyCreator      serviceChannelBuilder = new MonikerBuilder();
            IProxyManager      proxyManager          = new ProxyManager(serviceChannelBuilder);
            Guid               iid = typeof(IMoniker).GUID;
            IntPtr             ppv = OuterProxyWrapper.CreateOuterProxyInstance(proxyManager, ref iid);
            MarshalByRefObject ret = EnterpriseServicesHelper.WrapIUnknownWithComObject(ppv) as MarshalByRefObject;

            Marshal.Release(ppv);

            return(ret);
        }