C# Entity Framework with ASP.NET MVC Data Access Design Patterns Creating a Generic Base Repository Class

Nathan Yebgui
Nathan Yebgui
10,331 Points

IEntity not found.

I decided to go for the approach in the teachers comments for the Delete method. VS didn't recognize the IEntity interface and didn't have a namespace to suggest. So i created my own. Was this what was intended? MSDN does document an IEntity but it doesn't look like the interface in the teachers notes.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb231373(v=vs.85).aspx

Simon Coates
Simon Coates
28,661 Points

From how he expresses it ("For reference, here's the IEntity interface"), it does sound like James Churchill is showing it to us by way of interest (which made me curious as to why). However, i did see something a little similar at https://stackoverflow.com/questions/34767802/what-is-ientity-in-this-code-for-a-generic-repository-pattern ( though that person was using a class).

Not sure if it discusses it, but i'd assume you have to update the Model classes to implement IEntity. Otherwise passing in comicbook in the rewritten repositories (calling the base generic repository) would cause an error. After i fixed that, everything seemed to work okay.