Dynamicly create object at runtime....

D

Doug Swanson

We have a standard product that we deploy at multiple different client
sites. The problem is that we're getting to the point where some of the
clients want some "custom" code for specific business functionality. I
would like to be able to (and I have done this with clients but with custom
UI .aspx assemblies) have a custom assembly for a client and have the
specific part of our core code call a factory object which returns an
interface...the factory object would look in our database to see if this is
a custom client or to use the standard product. If it is a custom client
build the object (interface) using their custom assembly.....and return it
to our main code which works off of the interface....is this
possible?....here is a more detailed scenerio....printing labels...every
client wants something different...more data/less data different kind of
data....so as part of our "report_outputs" method we print some data to a
label...

sub report_outputs()
dim iPrint as LabelInterface()
dim iFactory as LabelFactory()
.....
iPrint = iFactory.GetLabelMaker()
iPrint.CreateLabels(byval OrderID as string)
end sub

Function LabelFactory.GetLabelMaker() as LabelInterface()
Dim sCustomAssembly as string

sCustomAssembly = GetCustomAssemblyName() <--some setup field in the
database...
If sCustomAssembly.length > 0 then
???? <- How do I create an object that I will only know at
runtime???
Else
'create our standard label object
return new StandardLabel()
End if
End Function


thanks
Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top