예제 #1
0
        ComProxy IProxyCreator.CreateProxy(IntPtr outer, ref Guid riid)
        {
            if ((riid != typeof(IMoniker).GUID) && (riid != typeof(IParseDisplayName).GUID))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidCastException(SR.GetString(SR.NoInterface, riid)));
            }
            if (outer == IntPtr.Zero)
            {
                throw Fx.AssertAndThrow("OuterProxy cannot be null");
            }

            if (comProxy == null)
            {
                ServiceMonikerInternal moniker = null;
                try
                {
                    moniker  = new ServiceMonikerInternal();
                    comProxy = ComProxy.Create(outer, moniker, moniker);
                    return(comProxy);
                }
                finally
                {
                    if ((comProxy == null) && (moniker != null))
                    {
                        ((IDisposable)moniker).Dispose();
                    }
                }
            }
            else
            {
                return(comProxy.Clone());
            }
        }
예제 #2
0
        ComProxy IProxyCreator.CreateProxy(IntPtr outer, ref Guid riid)
        {
            if ((riid != typeof(ITransactionProxy).GUID))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidCastException(SR.GetString(SR.NoInterface, riid)));
            }
            if (outer == IntPtr.Zero)
            {
                // transactions require failfasts to prevent corruption
                DiagnosticUtility.FailFast("OuterProxy cannot be null");
            }

            if (comProxy == null)
            {
                comProxy = ComProxy.Create(outer, txProxy, null);
                return(comProxy);
            }
            else
            {
                return(comProxy.Clone());
            }
        }