How to structure a layered architecture ASP.Net Core project in a (almost) clean way

preview_player
Показать описание
Sometimes the hardest thing is to get started! That's why in this video we describe how to structure a layered architecture ASP.Net Core project from scratch. During this video we start from a blank solution and aim to refactor the Asp.Net Core Web API template towards a layered architecture in a (almost) clean way. When creating each layer, we also go through the thought process of what belongs to each layer. in the end, we wire everything up together, taking advantage of the Asp.Net Core dependency injection container and the power of abstractions through interfaces.

Join this channel to get access to perks:

1. Why should we start from a blank solution? 00:00
2. Creating Visual Studio projects for each layer 03:59
3. Creating the domain layer 04:21
4. What should we put in the domain layer? 06:30
5. Creating the Data Access Layer (DAL) 09:52
6. What should we put in the DAL? 10:30
7. Creating the service layer 12:06
8. What should we put in the service layer? 13:27
9. Creating the presentation layer (ASP.Net Core Web API in this case) 15:56
10. Refactoring the domain layer 17:56
11. Implementing the DAL 27:15
12. Implementing the service layer 30:04
13. Wiring everything up with the ASP.Net Core dependency injection container 36:47
14. Summary 42:45

#aspnetcore #softwareArchitecture #dotnet
Рекомендации по теме
Комментарии
Автор

You're explanation is insanely awesome, no one talks about the n-layered architecture like you! they often put their domain models inside the Data Access layer!!! Not like you separated the domain model into a specific layer and made it below the Data Access layer so BAL and DAL both can use it. Thank you, sir.

Mohamed-puso
Автор

Very helpful for me. I will start using this method in my future development, it's clear and modern architecture.

saadatmane
Автор

Thank you for this straightforward, practical and simple course. I'm new in asp and it's helped me to learn Clean and Layer Architecture both for my new project.

aliesmaeili
Автор

Thank you so much for this video - it really clarified a lot for me. I arrived here out of frustration with my own "Fat Controllers" on a Web App MVC project: I knew my logic should go somewhere else but didn't know where to begin. This is the answer! Really appreciate you sharing your experience.

matburtcher
Автор

Very useful, I think I am going to have to watch this a few times and then code and example for it to stick. Many Thanks.

CheenaSingh
Автор

thank you so much, cleared lots of questions from my mind

yasinbastug
Автор

Thank you for your video. First time i'm approaching this kind of information, cuz re-skill from embedded devloper to web developer.

tankhangvan
Автор

Pure gold ! very informative and helpful, Thanks

dimags
Автор

Hello Dan, First of all Thank you for the video. I have few questions,

1) In which layer should DTO Models be used?
2) How do we handle complex JOINS on multiple entities? If we do Joins, should we return IQueryable for GetAll Methods from Repository? ( Case - Db First Approach without Scaffolding )
3) Where are Exceptions thrown? If we use Global Exception Handling, what happens? Is it a good idea to throw exceptions in the Service Layer?
4) Where should Custom Exceptions Classes go?
5) Where should the Request Model Validators Extension be located? (FluentValidation)

Please assist me because I am about to use this Layer for our upcoming project (smaller one)
Please advise if this is a good architecture to use.

nightgamer
Автор

Really really good explanation - smart guy!

CarrigansGuitarClub
Автор

Very good content there ! - thanks for making this

Zeuchon
Автор

Thank you so much for this. Very useful

kpadhnan
Автор

This is a great tutorial. I really appreciate your effort.

mohammedkarem
Автор

Thanks. Loved the video for every minute . Just curious if can have code access ? Thanks again

saqibali
Автор

Veryuseful, can you help or guide to add Dapper ORM into it

EshantKapoor
Автор

I am very thankful to you, It is very helpful for me. Could we apply Data first approach using Entity framework with PostgreSql DB for same structure?, And it is giving me a circular dependency error. Thanks

mohdaman
Автор

in this architecture Where would we put the Dtos? or where ot map it

rasheed
Автор

Thank you sir but can you please move your head on the screen so we can see the other files on the right side bottom. You can just use your voice while doing a tutorial. Great job on the tutorial tho :) thank you

bswill
Автор

hi good video,
how to insert update the api data into my database where we need to handle it.
do my controller need to access dal layer to save the entities or the service after all the business logic are moved to service

lsviioy
Автор

Hi - Thank you for a very useful introduction and example of this architecture. I have seen comments elsewhere that the Web or API Layer should not have a dependency on the DAL. Is there any alternative way to Inject the Repository in Startup (or elsewhere) without having an explicit reference to the DAL project?

davidsanderson
welcome to shbcf.ru