Search code examples
model-view-controllerrepositorybusiness-logic

MVC - Repository vs Business Layer


I am using MVC. I will be using the respository to retrieve necessary records I need through LINQ.

From my understanding, the Data Access is what I would do in the Repository.

For example, I can use LINQ to retreive some records in the repository.

Kind of confused on what the difference is between the Repository and Business layer. Aren't they one in the same. Meaning, I am using business logic to retreive the records in LINQ.


Solution

  • "What is the difference is between the Repository and Business layer, aren't they one in the same?”

    The Repository is just for retrieving business objects from, for example, a database.

    The Business layer is for business logic that usually manipulates business objects.

    So the answer is no, they are not the same.

    Your Business layer may well use a Repository to get the business objects, but that doesn't mean it is the Repository.