Reputation: 8644
What are the pros and cons of using static repositories in an ASP.NET MVC application?
Wouldn't it be better to have all the methods available all the time -> means that the class get's instantiated only once instead of having multiple controllers referencing to the same repository class and its methods?
Or do I get something wrong here?
All help is more than appreciated!
Upvotes: 12
Views: 1311
Reputation: 1038710
Pros:
Cons:
Remark: Instantiating the repository on every request shouldn't be regarded as a performance issue.
Upvotes: 13