开发者

Castle Facility using non default constructor in registration

开发者 https://www.devze.com 2023-03-14 07:02 出处:网络
I am trying to register a facility in Castle Windsor using the fluent apis (version 2.5.1). I am also trying to use a non default constructor (one that takes parameters). My current code looks like th

I am trying to register a facility in Castle Windsor using the fluent apis (version 2.5.1). I am also trying to use a non default constructor (one that takes parameters). My current code looks like this:

  IWindsorConatiner c= new 开发者_StackOverflowContainer();
  c.AddFacility<NHibernateFacility>();

The NHibernateFacility has another constructor, how do I tell Castle to use it instead?

/Konstantin


c.AddFacility("nh", new NHibernateFacility(...));

where "nh" is the id of the facility in the config.

0

精彩评论

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

关注公众号