Customize Windosor Castle and General

this is my code in Global.asax

 WindsorContainer container = new WindsorContainer();
container.Register(Component.For(typeof(IRepository<>))
                                       .ImplementedBy(typeof(NHRepository<>))
                                       .LifeStyle.Transient)

I tried translating it to the xml configuration file with this, but didn't work

<component id="NHRepository"
           service="NCommon.Data.IRepository'1, NCommon"
           type="NCommon.Data.NHibernate.NHRepository'1, NCommon.NHibernate"
           lifestyle="transient">
</component>

How to convert this code to configuration file like Windsor.config?

Tanks Mirko

+3
source share
1 answer

You need to use backticks , not apostrophes

<component id="NHRepository"
           service="NCommon.Data.IRepository`1, NCommon"
           type="NCommon.Data.NHibernate.NHRepository`1, NCommon.NHibernate"
           lifestyle="transient">
</component>
+4
source

Source: https://habr.com/ru/post/1732983/


All Articles