Entity Framework Leveraging Unity

Feb 1, 2010 at 3:25 PM
Edited Feb 1, 2010 at 3:27 PM

I was wondering what you thoughts would be on EntityFramework providing a overload to ObjectContext that could take a IServiceLocator and then be able to alternately go to the container for object instantiation. This would give the user control over how objects are created, which seems to be a deficiency of all Orms i have looked at.

Feb 1, 2010 at 5:02 PM

You shouldn't be getting entities out of a container, really, and you shouldn't be taking dependencies on the container explicitly in your system either. There are other ways to design this that avoid scattering dependencies all over the codebase.

IServiceLocator is a bad choice anyway since it doesn't tell you anything about what's in the locator, which makes it very hard to understand.