How to use StructureMap with OpenRasta
How do I use StructureMap with OpenRasta? Can I use it instead of the internal dependency resolver, or can I only use it in conjunction with the built-in DI (i.e. for my own application dependencies)?
thank
+3
Dave nichol
source
to share
1 answer
Map structure code here
Build it, then refer to the library. Or you could git submodulate it.
Then add the following code to your openrasta project p>
public class DependencyResolver : IDependencyResolverAccessor
{
public IDependencyResolver Resolver
{
get { return new StructureMapDependencyResolver(ConfigureContainer()); }
}
public static IContainer ConfigureContainer()
{
var container = new Container();
container.Configure(c => c.Scan(s =>
{
//normal SM registrations
}));
return container;
}
}
Hope it helps
ps Structure Map is not officially supported, you are probably better off with Castle / Ninject.
+2
Antony denyer
source
to share