What are benefits of having the IEntity interface? Do you use outside of your repository class? What for? If you are not using it outside your repository class I would argue you need this interface- last week I actually wrote a blog post about EF and repository pattern where I started from having a common interface with Id property all entities derived from and I concluded it was not needed - here is the link: http://blog.3d-logic.com/2013/03/24/hacking-linq-to-entities-with-expressions-part-1-really-generic-repository/. If you however need this interface I wonder why can't it be generic and take a type for the key. This way if you need to add an entity that has for instance a GUID key you would be able to use it.
↧