Say I have a nice domain model, using (constructor) DI where needed. Now I want to be able to persist this model, so I start adding infrastructure(Entity Framework) to do this. What happens now is that the persistence framework should be able to initialize your types using your IoC container.
Maybe this is possible, maybe not. Anyway, what I’m wondering now is; is it usual to use DI on you POCO classes at all? And if it is, how do I make Entity Framework use my favorite IoC container(in my case NInject) to construct my classes.
This is one of the religious arguments in the DDD community: should I inject services into my entities? It’s really a question that you’ll have to answer yourself. I”m not going to tell you what I think because it’s highly contextual – what I think changes depending on several factors.
I do think you need to take a few hours and really dig deep into the archives of the ddd list to establish an answer that will work for you.