Look Ma! Real Proxies…

I took some time today to pull down the source code for SvnBridge today, and man, I was blown away. I started at Program.cs and made it to line 25 Bootstrapper.Start(). From there I went on to look at the hand rolled container, then the ProxyFactory.

In order for me to fully grasp the System.Runtime.Remoting API for creating proxies I had to re-write the code from SVN Bridge…. I just had too… it’s just how I learn. It’s like tracing over cartoons when you’re a kid. I still do it!

In case you’re interested, the attached code is the sample I put together that is derived from the source code of SvnBridge. If you haven’t checked out the source for the project, you really should.

Pretty cool stuff…. Hopefully, this helps out anyone else who’s just as curious

My reduced sample source code…

private static void Main(string[] args)
{
    var marshal_mathers = new Person("marshall mathers");
    var some_celebrity = ProxyFactory.Create<IPerson>(marshal_mathers, new MyNameIsSlimShadyInterceptor());
 
    try
    {
        var name = some_celebrity.what_is_your_name();
        name.should_be_equal_to("slim shady");
    }
    catch (Exception e)
    {
        Console.Out.WriteLine(e);
    }
    Console.Out.WriteLine("will the real slim shady please stand up...");
    Console.In.ReadLine();
}

Related Articles:

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Mo Khan

mO, is just a kid who's excited about writing software. He's a student of his profession, and just wants to share his thoughts on software development.
This entry was posted in Design Patterns. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

Comments are closed.