开发者

How to convert Castle Windsor fluent config to xml

I would like to convert this fluent approach to xml:

container.Register(
    AllTypes.FromAssemb开发者_开发问答lyNamed("Company.DataAccess")
        .BasedOn(typeof(IReadDao<>)).WithService.FromInterface(),
    AllTypes.FromAssemblyNamed("Framework.DataAccess.NHibernateProvider")
        .BasedOn(typeof(IReadDao<>)).WithService.Base());

Is there any way of doing this, maintaining the simplicity?


Currently there is no way to do batch registrations in XML. If you really want to express this in XML (I wonder why) you'll have to enumerate each component to be registered.

The closest thing was the batch registration facility, but it has been deprecated.


You may want to try Binsor, which is a Boo DSL for registering components, but I'm not entirely sure how up to date it is.

Be advised that what you're trying to do is not a recommended practice and brings more headaches than true value. Stick to code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜