Can Castle Windsor do value injection?
For example, say I have a model object for an Employee with properties I want auto-mapped to an interface de开发者_如何学Goscribing a View for MVC.
I want a way for Employee.FirstName to be set automatically set to IEmployeeView.FirstName when my model data changes.
Right now I'm using ValueInjecter, but I'd like to drop the dependency on the assembly if Windsor can do it. (I'm already using Windsor for IoC and other AOP stuff)
It might be possible to do it with Windsor (or any other IoC container for that matter), but IoC containers are better suited to manage services, not data containers. If you try to manage data like that you will likely fall sooner or later into the service locator trap.
A proper alternative to ValueInjecter is AutoMapper.
You should check out MEF (http://mef.codeplex.com/). It is built into .NET 4.0.
精彩评论