开发者

Entity Framework and dependency injection

I'm using Entity Framework and the Unity as IoC. I want to use constructor injection within entities with ability to configure them from both config and run-time. I don't want to use the injection via properties. I want to make it the way so I don't need and any handlers in object context that supports injection for my entities. This sample I consider as the last resort Sample but I hope there are other ways to implement this. The开发者_高级运维re may be some extensions to the Unity or other IoC so that ObjectContext could resolve dependencies on its own.

thanks in advance.


use [Dependency] attribute for you constructor

see Unity 2 documentation in codeplex or msdn

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜