Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

3

private readonly ProductRepository prodRep = new ProductRepository(); private readonly UserRepository userRep = new UserRepository(); private readonly CarRepository carRep = new CarRepository(); private readonly RegistryRepository regRep = new RegistryRepository(); From a very pragmatic point of view, there's nothing inherently wrong with newing up your ...


2

Frankly, if your repositories don't have state (i.e. private member variables), their methods should be marked as static, and ergo, each repository class should be marked as static and you have no need to worry about instantiation anywhere. They're essentially utility functions to be called whenever you need them.


Top 50 recent answers are included