[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

How to activate local object in custom proxy?

Peter Jules

8/2/2004 6:07:00 PM

Hello,
I would like to intercept every creation of an object in my application.
Therefore I have created a custom proxy, derved the local object from ContexBoundObject, aso.
But I have not found a solution to forward the activation.
Here is the code:

-----------------------------------------------
public class CustomProxy : RealProxy
{
MarshalByRefObject target; // transp. proxy
public CustomProxy(Type type, MarshalByRefObject target) : base(type)
{
this.target = target;
}
public override IMessage Invoke(IMessage msg)
{
if(msg is IConstructionCallMessage)
{
Console.WriteLine("do sth. before");
// --> Forward construction of object here !
Console.WriteLine("do sth. after"); return crm;
}
...
}
}
----------------------------------------
What should I do to activate the object and obtain my IConstructionReturnMessage ?

Thanks a lot

Pete