3 December 2008

Look Ma! Real Proxies...

by mo

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. 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.CreateIPerson>(marshal_mathers, new MyNameIsSlimShadyInterceptor());

      var name = some_celebrity.what_is_your_name();
      name.should_be_equal_to("slim shady");
    catch (Exception e)
    Console.Out.WriteLine("will the real slim shady please stand up...");
csharp designpatterns