开发者

How to register NCommon with StruceMap?

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜