Comments (1)
I sometimes find value in using application services. My definition of application services is that they are services specific to the application, and usually that means they're tied closely to the UI. I don't always, or even often, add an application service "layer" because most of the time the UI can interact directly with the domain layer via repositories (to fetch and store entities), entities, and domain services. However, sometimes the UI needs to get data in a particular format that isn't closely mapped to the domain model. In this case, controllers or other UI classes can become bloated with mapping logic and calls to multiple repositories as they try to convert one model to another. This is where application services can be a big help, as they can hide away repositories and the domain layer from the UI layer, and perform any mapping between domain entities and UI-level DTOs or ViewModels, etc.
I do recommend, when possible, that a given class only work with a single abstraction level in terms of its dependencies (i.e. what's being injected via its constructor). It's not a strict rule, but if you can, try to have your services work only with repositories or other services, but not both. Same for controllers. If you're working one level above the repository abstraction level, that's different than if you're working one level above a services abstraction level. When you have mix, it's often a good idea to roll more of the low-level logic up into services so you can eliminate low-level dependencies on repositories, etc.
from cleanarchitecture.
Related Issues (20)
- Update to target latest net8 for Nov 2023 release HOT 1
- Api.Contracts project HOT 2
- Two sets of templates - Back end focused (Current [End Points]) and Front end focused (Blazor Web App) HOT 2
- Template Generated Solution Will not Build or Update HOT 2
- Please support domain event publishing of 'EntityBase<TId>' HOT 3
- Template Doesn't Work and Breaks Other Projects HOT 1
- Open the Discussions area in Github area so people can discuss the template and the whys
- Why is this repo using AutoFac instead of .NET's own DI infrastructure? HOT 3
- Handling Third-Party Authentication and Role Synchronization in DDD and Clean Architecture HOT 1
- GetContributorByIdRequest - Filename should probably match the classname
- Why is the implementation of the DeleteContributorService in the core layer? HOT 2
- Test case ReturnsTwoContributors() fails HOT 6
- Replace Autofac with Vanilla dotnet DI HOT 3
- Renaming Enhacement in Web Project. HOT 3
- Update Sample to Latest Version of Template HOT 4
- 404 when launching the project HOT 2
- Error when launching the newly created project from template HOT 2
- Add More Warning as Error Checks
- Mixed SharedKernel : Clean.Architecture and Ardalis HOT 1
- ProjectItemMarkComplete test fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cleanarchitecture.