HI, I'm using the repository pattern and am using Ninject to inject my context into my controllers. Since I can only have 1 context for migrations I am doing this:
public class DataRepository : ICustomProfileRepository,ICarRepository //etc etc for each interface
{
private readonly dB context = new dB();
Is this the best I can do? this concrete DataRepository could get quite large and could be quite a footprint to be used in all my controllers eg like:
public class ProfileController : Controller
{
private readonly ICustomProfileRepository _repository;
this concrete DataRepository could get quite large and could be quite a footprint to be used in all my controllers eg like:
Controller is an abstract class……Well, if you want to do something like that. Maybe you have to create your own abstract class that has implemented the interface of ICustomProfileRepository,ICarRepository ……and then let all of your other classes inherit
from it.
GorillaMann
Member
117 Points
332 Posts
Massive repo for DBcontext
Aug 18, 2012 07:10 PM|LINK
HI, I'm using the repository pattern and am using Ninject to inject my context into my controllers. Since I can only have 1 context for migrations I am doing this:
public class DataRepository : ICustomProfileRepository,ICarRepository //etc etc for each interface
{
private readonly dB context = new dB();
Is this the best I can do? this concrete DataRepository could get quite large and could be quite a footprint to be used in all my controllers eg like:
public class ProfileController : Controller { private readonly ICustomProfileRepository _repository;Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Massive repo for DBcontext
Aug 20, 2012 01:41 AM|LINK
Controller is an abstract class……Well, if you want to do something like that. Maybe you have to create your own abstract class that has implemented the interface of ICustomProfileRepository,ICarRepository ……and then let all of your other classes inherit from it.
Reguards!