RealProxy::InitializeServerObject Method (IConstructionCallMessage^)
Initializes a new instance of the object Type of the remote object that the current instance of RealProxy represents with the specified IConstructionCallMessage.
Assembly: mscorlib (in mscorlib.dll)
public: [SecurityCriticalAttribute] [ComVisibleAttribute(true)] IConstructionReturnMessage^ InitializeServerObject( IConstructionCallMessage^ ctorMsg )
Parameters
- ctorMsg
-
Type:
System.Runtime.Remoting.Activation::IConstructionCallMessage^
A construction call message that contains the constructor parameters for the new instance of the remote object that is represented by the current RealProxy. Can be null.
Return Value
Type: System.Runtime.Remoting.Activation::IConstructionReturnMessage^The result of the construction request.
| Exception | Condition |
|---|---|
| SecurityException | The immediate caller does not have UnmanagedCode permission. |
If the ctorMsg parameter is null, then the InitializeServerObject method calls the default constructor for the new instance of the remote object that is represented by the current RealProxy.
virtual IMessage^ Invoke( IMessage^ myMessage ) override { Console::WriteLine( "MyProxy 'Invoke method' Called..." ); if ( dynamic_cast<IMethodCallMessage^>(myMessage) ) { Console::WriteLine( "IMethodCallMessage*" ); } if ( dynamic_cast<IMethodReturnMessage^>(myMessage) ) { Console::WriteLine( "IMethodReturnMessage*" ); } if ( dynamic_cast<IConstructionCallMessage^>(myMessage) ) { // Initialize a new instance of remote object IConstructionReturnMessage^ myIConstructionReturnMessage = this->InitializeServerObject( static_cast<IConstructionCallMessage^>(myMessage) ); ConstructionResponse^ constructionResponse = gcnew ConstructionResponse( nullptr,static_cast<IMethodCallMessage^>(myMessage) ); return constructionResponse; } IDictionary^ myIDictionary = myMessage->Properties; IMessage^ returnMessage; myIDictionary[ "__Uri" ] = myUri; // Synchronously dispatch messages to server. returnMessage = ChannelServices::SyncDispatchMessage( myMessage ); // Pushing return value and OUT parameters back onto stack. IMethodReturnMessage^ myMethodReturnMessage = dynamic_cast<IMethodReturnMessage^>(returnMessage); return returnMessage; }
For the ability to call unmanaged code. Demand value: SecurityAction::LinkDemand; Permission value: SecurityPermissionFlag::UnmanagedCode
Available since 1.1