Wednesday, October 05, 2005

Implementation of Factory pattern, Smart Client and Refletion.

all these tricks can be achived throug reflection. An amazing thing that i thinks alot in my early programming days. And in end i got all these functionalities through reflectin.a smart client is an windows based application that is dynamically reffering some assemblies, those resides somewhere else with the help of iis.


SmartClient objSmartClient = new SmartClient();
//display splash screenSplash splash = new Splash();
splash.Show();
Application.DoEvents();
// Set the URL to load the Assembly fromstring
strURL = @"C:\Documents and Settings\alif\My Documents\dotnetprojects\SmartServer\bin\Debug\Smart.exe";
// Set the class to callstring
sClassName = "MySmartClient.SmartForm";Assembly assemblyContent = null;
assemblyContent = Assembly.LoadFrom(strURL);splash.Close();
// Create a object for the ClassType
typeContent = assemblyContent.GetType(sClassName);
// Invoke the method. Here we are invoking the
Main method.typeContent.InvokeMember ("Main", BindingFlags.Public BindingFlags.InvokeMethod BindingFlags.Static, null, null, null);

0 Comments:

Post a Comment

<< Home