Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / ComIntegration / MonikerBuilder.cs / 1 / MonikerBuilder.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.ComIntegration
{
using System;
using System.Reflection;
using System.Collections.Generic;
using System.Threading;
using System.ServiceModel.Channels;
using System.Runtime.Remoting.Proxies;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Services;
using System.Runtime.InteropServices;
internal class MonikerBuilder : IProxyCreator
{
ComProxy comProxy = null;
private MonikerBuilder ()
{
}
void IDisposable.Dispose ()
{
}
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)
{
DiagnosticUtility.DebugAssert("OuterProxy cannot be null");
throw DiagnosticUtility.ExceptionUtility.ThrowHelperInternal(false);
}
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 ();
}
bool IProxyCreator.SupportsErrorInfo (ref Guid riid)
{
if ((riid != typeof (IMoniker).GUID) && (riid != typeof (IParseDisplayName).GUID))
return false;
else
return true;
}
bool IProxyCreator.SupportsDispatch ()
{
return false;
}
bool IProxyCreator.SupportsIntrinsics ()
{
return false;
}
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;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AsymmetricAlgorithm.cs
- CodeAssignStatement.cs
- TabRenderer.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- ProxyAttribute.cs
- RemotingAttributes.cs
- SrgsSemanticInterpretationTag.cs
- Monitor.cs
- RuntimeArgumentHandle.cs
- SchemaInfo.cs
- BuildProvidersCompiler.cs
- ParagraphResult.cs
- RegisteredHiddenField.cs
- CompilerWrapper.cs
- GraphicsContainer.cs
- ExtensionWindowHeader.cs
- CheckoutException.cs
- ClientBuildManagerCallback.cs
- XmlFormatReaderGenerator.cs
- ValidatorCollection.cs
- Resources.Designer.cs
- TextEditorParagraphs.cs
- XmlAtomicValue.cs
- ConvertersCollection.cs
- ImmutablePropertyDescriptorGridEntry.cs
- AccessDataSource.cs
- ListSurrogate.cs
- ClientCultureInfo.cs
- DataContractAttribute.cs
- DbParameterHelper.cs
- updatecommandorderer.cs
- XPathNodeHelper.cs
- XmlSchemaSubstitutionGroup.cs
- Dispatcher.cs
- XmlSerializableServices.cs
- UpDownBase.cs
- LocalizableResourceBuilder.cs
- BitmapFrameDecode.cs
- Grant.cs
- FixedTextPointer.cs
- DynamicQueryStringParameter.cs
- String.cs
- PriorityQueue.cs
- OleDbEnumerator.cs
- OleDbFactory.cs
- HtmlTableCell.cs
- PeerApplicationLaunchInfo.cs
- NativeMethods.cs
- KeyboardDevice.cs
- StorageMappingItemLoader.cs
- ChildTable.cs
- SchemaLookupTable.cs
- SqlConnectionHelper.cs
- Boolean.cs
- xml.cs
- OdbcConnectionOpen.cs
- ConnectionPoint.cs
- OleDbPropertySetGuid.cs
- NodeLabelEditEvent.cs
- IdentityNotMappedException.cs
- AvTraceDetails.cs
- ModuleElement.cs
- DataGridViewRowPrePaintEventArgs.cs
- Config.cs
- WebPartDisplayModeEventArgs.cs
- SqlSelectStatement.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- QuinticEase.cs
- OletxEnlistment.cs
- RelationshipNavigation.cs
- FrameworkRichTextComposition.cs
- DesignRelationCollection.cs
- Package.cs
- PropertyEntry.cs
- WpfKnownTypeInvoker.cs
- GridProviderWrapper.cs
- InternalControlCollection.cs
- wmiprovider.cs
- PageThemeParser.cs
- ToolStripSplitButton.cs
- UnknownBitmapDecoder.cs
- HandleExceptionArgs.cs
- httpapplicationstate.cs
- SqlCommandBuilder.cs
- entityreference_tresulttype.cs
- PresentationAppDomainManager.cs
- StructuralComparisons.cs
- BoolLiteral.cs
- ArglessEventHandlerProxy.cs
- QueryStringHandler.cs
- SafeRegistryHandle.cs
- sqlnorm.cs
- PropertyBuilder.cs
- ZipIOModeEnforcingStream.cs
- Pair.cs
- WindowsSidIdentity.cs
- RuntimeResourceSet.cs
- DmlSqlGenerator.cs
- CallbackValidator.cs
- PriorityItem.cs