ASP.NET service vs repository layers

后端 未结 3 753
故里飘歌
故里飘歌 2021-01-31 18:09

What is the difference between a service layer and a repository? I have worked through a lot of demo ASP.NET MVC apps and most of them have just repositories. And some have a

3条回答
  •  余生分开走
    2021-01-31 18:16

    A repository typically handles data-access only. A service layer will use a repository, and apply any additional business logic. Think of the repository as a re-usable layer than could be used by anything that wants to access your data. Different apps might have different business rules (that would go in the service layer), but could all use the same repository layer implmentation

提交回复
热议问题