I'm using StructureMap on WCF service and MVC 4 application, I have configured it on both of them, but once I run the application I receive the following exception:
StructureMap Exception Code: 202 No Default Instance defined for PluginFamily LookupsRepositories.Lookups.ILookupRepository`1[[JE.Domain.Lookups.Status, JE.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], LookupsRepositories, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The LookupRepository
is an abstract class, a generic class, this is how I register it:
For(typeof(ILookupRepository<>)).Use(typeof(LookupRepository<>));
For<ILookupUnitOfWork>().Use<LookupUnitOfWork>();
Scan(s =>
{
s.AssemblyContainingType(typeof(LookupRepository<>));
s.ConnectImplementationsToTypesClosing(typeof(ILookupRepository<>));
});
Calling the registry in Global.asax
:
protected void Application_Start(object sender, EventArgs e)
{
ObjectFactory.Initialize(x => x.AddRegistry(new JedcoRegistry()));
}
Still I got the exception. Any idea why?
Note: StructureMap version 2.6.4.0