Reputation: 25
I have seen in many MVC project concept of Repository but i dont know why many mvc developers use repository.
What is the advantage of creating repository ?
What is the use of repository?
If it improves performance then how it improves performance?
Are there any guidelines to create repository??
Upvotes: 0
Views: 4728
Reputation: 8197
The concept of repositories is referred to DDD.
It is best to read the book about DDD by Eric Evans.
In short, the repository allows you to hide details of loading objects from a database. This is especially useful for complex composite objects.
Upvotes: 4
Reputation: 746
@lmad, what you described in you guideline is not repository - it's just a view model in context of MVVM pattern. Repository is a pattern for data access logic, where you define your own contract for data access. In C#, for instance, once you defined repository interfaces, then distinct implementations of every interface can be easily changed by each other.
@Maria Pithia, it will be enough for you: msdn - repository description. Hope, this will help.
Upvotes: 0
Reputation: 7490
Guidelines
i. Create repository to represent table in database, columns will be properties of that repository.
ii. Create repository which to bind strongly typed view. Its properties will be all attribute you want to display using view.
Upvotes: 1