Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

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,694 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.