cdfllc
asked on
Create Instance of an Interface
I thought this would be easy :) And it probably is, but I've searched and can't find anything...
Isn't there an equivalent for "getClassForName" from Java?
I have an interface, but don't know what specific class I want to load until runtime. Sure you've heard this before. I want to grab the string of the name from the Web.config file and dynamically create a class of that type...
For example,
public static IServiceProvider GetServiceProvider()
{
if (serviceProvider == null)
{
String ServiceProviderObjectName = GlobalConfigurations.Servi ceProvider Type;
serviceProvider = (IServiceProvider)Activato r.CreateIn stance(nul l,ServiceP roviderObj ectName );
}
return serviceProvider ;
}
What am I missing? And if it's all that stuff about assemblies, etc. Could someone give me the 2 minute drill on what that stuff is...:)
Thanks!
cdfllc
Isn't there an equivalent for "getClassForName" from Java?
I have an interface, but don't know what specific class I want to load until runtime. Sure you've heard this before. I want to grab the string of the name from the Web.config file and dynamically create a class of that type...
For example,
public static IServiceProvider GetServiceProvider()
{
if (serviceProvider == null)
{
String ServiceProviderObjectName = GlobalConfigurations.Servi
serviceProvider = (IServiceProvider)Activato
}
return serviceProvider ;
}
What am I missing? And if it's all that stuff about assemblies, etc. Could someone give me the 2 minute drill on what that stuff is...:)
Thanks!
cdfllc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER