Mark Michaelis' Weblog :
Updated: 9/1/2004; 6:55:10 AM.

 








Subscribe to "Mark Michaelis' Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

Subscribe To
Mark's Weblog

 
 

Wednesday, January 01, 2003

Some Remoting Stuff
Google Search It

I confess that of all the stuff in the .NET Framework the one that I am most attracted to is the remoting stuff.  The problem is that recently I have spent too little time coding.  Tonight I stepped back a bit and tried a simple example.  Essentially what I wanted to do was override the new keyword just like a System.Runtime.Remoting.RemotingConfiguration.Configure( ) except that I want the type returned by new to be a type derived from the one specified.  For example:

// ;Reconfigure new so that MyPerson is instantiated 
// when new Person is called.

Michaelis.Runtime.Remoting.RemotingConfiguration.Configure(
     Person, "MyAssembly.MyPerson");
// Instantiate something of type MyPerson even 
// though Person is specified.

Person person = new Person();

The reason for this craziness is that I hope to provide a level of customization for UI components such that via a configuration file someone could customize the UI and have their components created rather than the once I hard code.  That would allow customization to begin with my implementation but then tweak it by adding that all important extra data field and such.

Simple idea but how the heck to do it?  Seems like the first thing to do is figure out how System.Runtime.Remoting.RemotingConfiguration.Configure( ) works.

Side Notes

  • I have often used System.Runtime.Remoting.RemotingServices.IsTransparentProxy() to verify that I successfully instantiated a remote object.  It turns out that each time I did this it was for MarshalByRefObjects only.  Serializable objects will return false since they are not proxies (objects are passed by value). 
  • There is a program in the Framework SDK called WinCV that allows you to view definition of any class in the framework simply by typing it in.  As you type it filters out the items that don't match.  What is especially nice about this utility is that it is not limited to the documented classes and instead includes those that are not documented.
  • When working with remoting (or AppDomains) and NUnit you need to be sure to specify the ApplicationBase (the base path in which DLLs are located) when calling AppDomain.CreateDomain().  This can be done as a parameter to CreateDomain() or by passing an AppDomainSetup whose ApplicationBase property is set.  The problem is almost certainly due to the fact that NUnit is using a shadow (see AppDomainSetup) copy similar to IIS.  To set the ApplicationBase generically set it to System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).
  • Ingo Rammer has an implementation of an SMTP/POP3 channel.
  • Speaking of custom channels, CodeProject has an MSMQ Channel written by Roman Kiss.  I had a beta implementation of such a channel but having someone else take on the burden of maintenance is great to see.  Way to go Roman.
  • I have come across it before but now I would like to document it.  The .NET 247 web site is essentially trying to provide documentation and examples on every class in the framework.  So if you have a question on a particular class and the MSDN documentation doesn't cut if for you then check out this site.  It perhaps has better samples and over time it will only get better.
  • After coming across Chris Sells' reference to ScanCodeMapper I created a registry file that disables CAPS-lock and INSERT.
  • I came across a post by Don Box's where he shares the importance of implementing IMessageSink for object that derive from MarshalByRefObject if you want to avoid the stack builder sink.

11:24:49 PM   []    comment []

© Copyright 2004 Mark Michaelis.



 


January 2003
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Dec   Feb


Recent Posts