jonathanpeppers
jonathanpeppers

Reputation: 26495

Castle Windsor - Value Injection

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 describing 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)

Upvotes: 3

Views: 766

Answers (2)

Derek Smith
Derek Smith

Reputation: 231

You should check out MEF (http://mef.codeplex.com/). It is built into .NET 4.0.

Upvotes: 0

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99720

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.

Upvotes: 4

Related Questions