Create generic class instance throws TypeLoadException
- by Elisa
My TestLayer class has the namespace: "BLL.Infrastructure.TestLayer" and is inside the assembly: "BLL"
public class LayerFactory<T, U>
{
public static IBaseLayer<T, U> Get()
{
var obj = Activator.CreateInstance("BLL", "BLL.Infrastructure.TestLayer", new object[] { (IBaseLayer<T, U>)null });
}
}
When I run the code the Activator throws an TypeLoadException with no more details
Thats the concrete class it should create:
GenericBaseLayer implements the IBaseLayer.
public class TestLayer<T, U> : GenericBaseLayer<MyRequest, MyInfo.ActionType>
{
public TestLayer(IBaseLayer<MyRequest, MyInfo.ActionType> layer)
: base(layer)
{ }
}
What do I wrong?