Entity Framework context wrapper
Due to a strong will of our customer on my current project we have to use Entity Framework as ORM. There are many drawbacks in it, I am not going to post complains. The biggest problem for me is that I am unable to mock entity framework context for unit-testing. To make mocking convinient, a class must implement an interface. With an interface one can create different implementation for test purposes. It could be in-memory virtual database which makes it easy to emulate different cases and works very fast. I used to work with Linq to SQL and there was quite easy way to wrap it in an interface. With Entity Framework things are more difficult. Linq to SQL uses generics a lot, while entity framework just generates dumb properties and methods for entity collections and uses string hardcoding a lot instead of generics. So, one day,I decided to solve this for myself. Read more »
Comments (1)