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.
精彩评论