IM using NCommon with NHibernate and would like to use StruceMap as my IOC. Doesnt anyone know how to register NCommon with StructureMap?
Here is the info on NCommon.
https://github.com/riteshrao/ncommon/
Here is how its done with Castle Windsor
foreach (var type in types)
container.Register(Component.For<IController>().ImplementedBy(type)
.LifeStyle.Transient
.Named(type.Name.Replace("Controller", "")));
var containerAdapter = new NCommon.ContainerAdapter.CastleWindsor.WindsorContainerAdapter(contain开发者_运维技巧er);
Something like this should do the job:
containter.Configure(c => {
foreach (var type in types)
c.For<IController>()
.Use(type)
.Named(type.Name.Replace("Controller", ""));
});
var containerAdapter = new NCommon.ContainerAdapter.StructureMap.StructureMapContainerAdapter(container);
精彩评论