The service layer is home to the business logic within the application. Majority of code will live here. The service layer will interact with
Selector classes, as well as other
Service classes as needed.
Service layer classes should remain caller agnostic. Controllers, batch jobs and web services should all be able to call the same logic without any side effects.
Creation and commiting of the
UnitOfWork instances should occur here.
UnitOfWork can be passed down to
Domain classes to handle finer grain single object logic.
Service layer classes only follow one naming convention, to be appended with
Service. Prefixing service classes with a project name or group name is good practice.
PrefixNamecould be a type of service (e.g.
Internal*), project name or namespace to keep similar service classes close.