Friday, January 11, 2019

Repository pattern versus Service layer

What is the difference between the repository pattern and the service layer concept ?


A Repository is a facade for persistence that implement CRUD access to data/object.

Martin Fowler's Definition.


A service: A class that contains business logic that does not belong to the object model.
A class that implements a set of available operations and coordinates the application's response in each operation.

My guess is that a service could use a repository.

Martin Fowler's Definition.

ASP.NET MVC Web Api / ASP.NET Core Api

In an ASP.NET Core Api, implementing a REST Api, we would find the following layers
  • Controllers
    • Services
      • Repository Implementation
      • EMailNotification Service
      • Other Services
See source code reference  madskristensen Miniblog.Core

No comments:

Post a Comment