Reputation: 82267
So, I am trying to implement best practices during the design phase of a system. I am going to be using a DI container (ninject) with Entity Framework 4, ASP.NET MVC 3 C#, and the repository / unit of work pattern.
GenericRepository<TEntity>
defined for use with entities that require only minimal access such as basic CRUD.Bind<ITRepository>().To<EFTRepository>()
in the factory's AddBindings() method.Am I going about this right? I haven't used this set of patterns before and want to make sure I am going to be using them correctly. Criticisms welcome!
Upvotes: 3
Views: 1420
Reputation: 30152
Inheriting from a base repository can provide some simple 'generic' functions but in other situations you'll quickly find out it becomes messy trying to have a generic based repository (assuming that was what was inheriting).
Everything else you described seems pretty good.
You didn't say what was going to be injected where though, I'm assuming you will be injecting a service, the service will take a unit of work (IUnitOfWork for ex., created as a per request instance) and an IWhateverRepostory
Upvotes: 3