Clean Architecture with ASP.NET Core 6

  Рет қаралды 389,722

dotnet

dotnet

Күн бұрын

Пікірлер
@Greenthum6
@Greenthum6 3 жыл бұрын
There are two fundamental issues that are often overlooked in these simplified clean architecture templates. First, UI depends on infrastructure. That dependency is usually not visible in charts for whatever reason, but it is there regardless. Secondly, the template uses core entities within DbContext in infrastructure. Now your database structure depends on domain entities. Those will evolve and your database breaks. Keeping database and domain entities separate is very important. I have used clean architecture for sometime, but in my model the core is split further into domain and application layers.
@cheesypufs
@cheesypufs 3 жыл бұрын
I agree about splitting the entity models and domain models. However this would be less necessary if you use something like EFCore migrations to ensure your DB is always updated. Although I've never been a fan of this approach, it feels fragile.
@Greenthum6
@Greenthum6 3 жыл бұрын
@@cheesypufs I haven't heard anyone using EF migrations in production and suggest nobody to do it. DBAs will not be happy. In critical systems database changes require review before apply. Keeping them in pure SQL is the cleanest approach. DbUp has been a great choice. The main issue with EF here is that it is too easy to spread database details everywhere. With clean architecture, only infrastructure layer should be responsible for database concerns. If there is only one entity through the application then everything depends on everything. Mapping objects is the necessary evil to keep consistency.
@k-ravndal
@k-ravndal 3 жыл бұрын
@@cheesypufs The main issue when using the same entity for both the domain and the db, is that you might end up in a situation where the structure or limitations of the database, also limits the way you build you domain. A database is an implementation detail, and should in no way govern the way you build your domain model.
@ApolloJKD1973
@ApolloJKD1973 3 жыл бұрын
Exactly! I have the same exact view. I use a mix of Clean Architecture and Vertical Slice Architecture (Jimmy Bogard). There are many videos on this from Jason Taylor such as this: kzbin.info/www/bejne/mnyXipVsYrGrd80 Basically all the logic is in the Architecture layer either in MediatR commands or Queries. The Application Layer and the Domain Layer combined make up the Core. The Domain Layer does not have logic for the most part. I have always found it hard to accept how putting logic in your Domain Entities is recommended. Other than the basic logic that you can put there (such as date range validations etc), we typically work with very complex logic in our applications and our Entities are used in different ways across the system. Another point where I agree with you is that no matter how much we can say we can swap out database technologies it is not easy to do. You cannot easily go from SQL and EF Core to CosmosDB without changing a lot of code! Again if your system is as simple as each Entity can save itself bla bla bla and thats it maybe you could do it with minimum coding. But that is not realistic. I have EF Core Queries that span entities and are highly complex. Good luck rewritting all that using a different technology easily!
@ApolloJKD1973
@ApolloJKD1973 3 жыл бұрын
@@Greenthum6 EF Core migrations do not need to be automatically applied to production. You can generate a SQL script from the migration and have your DBA's review and approve before you run it.
@RoggemansG
@RoggemansG 3 жыл бұрын
Thank you Steve for all these precious gifts you make for us!
@vincidixit
@vincidixit 3 жыл бұрын
Very helpful. Well explained with examples and demo. This will definitely make things easy.
@albxdotcom
@albxdotcom 2 жыл бұрын
Thanks Steve...great work again !! I'm enjoying working with Clean Architecture, it doesn't feel like all the pieces are super glued together anymore.
@Ardalis
@Ardalis 3 ай бұрын
Exactly what it's designed for!
@CodewithFemi
@CodewithFemi 3 жыл бұрын
Thanks Steve for taking us through this. I love clean architecture!
@Gonkers44
@Gonkers44 3 жыл бұрын
I really don’t understand the point of the shared kernel project. I understand this was an abbreviated talk, but I don’t think that was covered well.
@steve-ardalis-smith
@steve-ardalis-smith 3 жыл бұрын
It's purely a way of sharing (high level, abstract) code between apps. If every app uses the same guard clause extensions or value object base class, or exception base class, this provides a better tool than copy-paste or sharing the same source files for achieving this reuse.
@caglarad2544
@caglarad2544 2 жыл бұрын
Thanks Steve for sharing your valuable information with us.
@Sad-Lemon
@Sad-Lemon 2 жыл бұрын
I absolutely love the shirt :D Just started watching :)
@cethrivias
@cethrivias 3 жыл бұрын
It finally clicked for me why it is called *Domain-Driven* Architecture
@Erril_Ferndal
@Erril_Ferndal 2 жыл бұрын
Thanks Steve! I really like Clean Architecture
@S3Kglitches
@S3Kglitches 3 жыл бұрын
this video is extremely useful and people have to realize that it is a more robust extension of three-tier architecture
@browaruspierogus2182
@browaruspierogus2182 2 жыл бұрын
Any and every company can manage the code as they want and according to in-house convenience standards - this is just another shuffle of someone's ambition or corporate idea that is not necessarily as good as they think
@belmo_
@belmo_ 3 жыл бұрын
I didn't know that I needed this video.
@BabakSekandari-q1c
@BabakSekandari-q1c Жыл бұрын
In a different tutorial, I heard that all of MVC in a Core project was the presentation layer and that business logic should be coded in a a class library in a different project. In this tutorial (if I've understood it correctly) the presentation layer and business logic are within the Core project. At time 7:51, it states, "Model all business rules and entities in the Core project." Perhaps some further explanation can clarify this for me.
@jegtugado3743
@jegtugado3743 3 жыл бұрын
Awesome presentation. This reinforced my understanding of implementing DDD and Clean Architecture. Thank you, cool template.
@nicolasundiano8406
@nicolasundiano8406 2 жыл бұрын
if you have constants in a class Roles such as "Admin", "DemonUser", etc and you use it in all layers, where would you put this class? and the same as helpers like PaginationHelper to calculate Skip and TotalPages
2 жыл бұрын
Constants to the Core project. PaginationHelper to the project where your UI lives.
@jez9999
@jez9999 2 жыл бұрын
Why is there never an acknowledgement that in order to make "clean" architecture, you introduce massive amounts of complexity? Having to learn all the new terminology for stuff like value objects, domain events, validators, custom guards, etc. and figure out how to structure it all is no mean feat, and is a lot harder and less intuitive that just creating an n-tier application, to the point where an n-tier application is probably the best choice for anything but huge projects. 21:20 Composition root in the web project. I've noticed this before. So much for "clean architecture" stopping the UI from referencing infrastructure; it has the composition root. It has to reference everything!
@Ardalis
@Ardalis 3 ай бұрын
"It's too complex!" but also "You should have added yet another project for composition root!" It's a tradeoff. Yes, you certainly *can* put all the DI/composition root logic into another project, but that only adds to the complexity without adding much value. You can certainly do that if it makes sense for your app.
@ebrimasidibeh7587
@ebrimasidibeh7587 2 жыл бұрын
Nice one 👍. I love DDD and there is always different ideas among developers about its architecture but having standard template is awesome 👌
@srivathsaharishvenk
@srivathsaharishvenk 3 жыл бұрын
This is one way of achieving clean architecture, this is mostly OO based, however in my view there is a much simpler way, Please see Domain Modelling made functional by Scott Wlaschin and thank me later. Everything in there can be done in any language and especially c#. The main difference is it is better not to include any IO related logic (DB, API, email sender, etc.) in the core domain layer as much as possible, even the interfaces
@steve-ardalis-smith
@steve-ardalis-smith 3 жыл бұрын
Yes you can certainly achieve similar things in functional languages. This is "mostly OO based" because C# is an OO language.
@srivathsaharishvenk
@srivathsaharishvenk 3 жыл бұрын
@@steve-ardalis-smith I guess, regardless of the paradigm, the concept is still the same, it is better to avoid IO in the domain layer as much as possible, also IMHO c# is an hybrid language these days, not just OO
@dvanrooyen1434
@dvanrooyen1434 3 жыл бұрын
I have learnt from experience, the application/business needs should help drive the architecture and not the other way round. So for example in the industry we do say let’s make sure we have clean architecture so that we can focus the business needs rather than fighting the technology as the application grows. This has merit and is correct, but is too late in the process. Understanding the business need in a ‘clean’ manner will help getting the right architecture in place, which in turn then helps us focus on the business and all that good stuff.
@PeriMCS
@PeriMCS 3 жыл бұрын
Uncle bob taught me this Clean Architecture about 20 years ago. I thought I will see something new here.
@evgeni-nabokov
@evgeni-nabokov 3 жыл бұрын
Who is he?
@rodelias9378
@rodelias9378 2 жыл бұрын
Really awesome talk! Thanks a lot!!
@MostafaAjy
@MostafaAjy 2 жыл бұрын
Can I use database first in clean arch???? Plz help me
@mohdilyas7962
@mohdilyas7962 2 жыл бұрын
Hi, Please explain how the architecture changes when the database first approach is being followed. I didn't find much information about it as I need to implement Clean architecture with the existing database model. Please explain.
@activoutdavid
@activoutdavid 2 жыл бұрын
I think that uou need to create "clean" domain entities in Core and have your Infrastructure convert between those and your existing database model.
@Ardalis
@Ardalis 3 ай бұрын
@@activoutdavid Yes, exactly. The db first entities would need to live in an infrastructure project, and you would map to/from them, ideally. It may not be worth the effort, though...
@hussainhussaini2267
@hussainhussaini2267 2 жыл бұрын
I don't understand something. I pulled the sample solution and see the Web project has no reference to the Core project, while it has a reference to the Infrastructure project. This not what stated in the video. In the video it's said that both Infrastructure and Web projects should talk through Core project indirectly
@haroldpepete
@haroldpepete 2 жыл бұрын
Great talk, it would be nice if you put a QR code next to each link in the presentation, you don't see anytihing in the description of the video in youtube about links in the current presentation, sometimes links are so large
@Ardalis
@Ardalis 3 ай бұрын
That's a great idea! I'll keep it in mind going forward.
@yasharaliabbasi5653
@yasharaliabbasi5653 2 жыл бұрын
Thank you for your useful topic, How should we add authentication and authorization?
@activoutdavid
@activoutdavid 2 жыл бұрын
That's very good question. I suggest that you use standard .NET authentication and authorization and implement Policies that are implemented by calling interfaces in the Domain/Core, probably with help for example a user database from Infrastructure.
@muhammedshibin7786
@muhammedshibin7786 3 жыл бұрын
What if we have some , say DTOs that needs to be passed down for service implementation, where should we place them
@steve-ardalis-smith
@steve-ardalis-smith 3 жыл бұрын
"It depends". Sometimes it's really helpful to have DTOs in the Core project so everything can use them. However, most of the time these DTOs are only really used by some specific service, and aren't really a part of the "domain model". As such, they usually belong in the Web or Infrastructure project, or sometimes in a separate project (or nuget package) that these projects both reference. In that case it's usually a good idea to keep that project/package small and focused just on DTOs used for a specific purpose.
@muhammedshibin7786
@muhammedshibin7786 3 жыл бұрын
@@steve-ardalis-smith thanks
@julietchoy
@julietchoy 3 жыл бұрын
Thank you so much for putting this up!!
@nelsonthekinger
@nelsonthekinger 3 жыл бұрын
26:40 - I don't get the advantage of separating the specification from the repository, is it the possibility of reusing specifications over different repositories?
@nelsonthekinger
@nelsonthekinger 3 жыл бұрын
Oh and Great work with the presentation by the way
@Quasindro
@Quasindro 3 жыл бұрын
As the project grows bigger, you won't have a bloated and messy repository class. At least that's how I look at it.
@lakshparab7066
@lakshparab7066 2 жыл бұрын
I think realistically it not possible to simply replace the DB without changing Domain Service logic. With proposed clean architecture the EntityFramework is now abstracted but ApplicationCore is now depend on `Ardalis.Specification` which is just a wrapper around EF and exposes EF's extension methods via Specification. For example Include(), AsNoTracking() etc which may not be suitable for different database. So if you change DB, you most probably have to change specifications and that means domain service as well.
@activoutdavid
@activoutdavid 2 жыл бұрын
As Steve mentioned, Ardalis.Specification is one of his own projects, and most Clean Architecture implementations probably don't have it unless they use his Clean Architecture template... :)
@francogiulianopertile279
@francogiulianopertile279 2 жыл бұрын
Aweesome presentation
@zerosandones7547
@zerosandones7547 2 жыл бұрын
should we put our Extensions in the Domain/Core project as well?
@activoutdavid
@activoutdavid 2 жыл бұрын
I suggest that you put extensions classes in the same project and namespace as the class or interface they are extending, when possible.
@zerosandones7547
@zerosandones7547 2 жыл бұрын
@@activoutdavid even if they're just strings extensions?
@cburys
@cburys 2 жыл бұрын
regarding the diagram at 6:44 and how everyone says dependencies should flow towards the core project, doesn't the core project have to import the infrastructure project? Are y'all saying it's not dependent on it simply because the interfaces for the services and models are defined in in the core project?
@yuvarajvelmuruganmudaliyar
@yuvarajvelmuruganmudaliyar 2 жыл бұрын
Domain layer is the CORE and it doesn't depends on anything else. The core contains domain/business models and domain/business logic.
@Ardalis
@Ardalis 3 ай бұрын
@@yuvarajvelmuruganmudaliyar Correct. It uses the Dependency Inversion Principle such that interfaces are defined in Core/Domain project but implementations are in Infrastructure project.
@baolam4180
@baolam4180 2 жыл бұрын
Thanks. Great explanation at right time for me 😍
@shatiswaranvigian9349
@shatiswaranvigian9349 2 жыл бұрын
Very helpful, thank you.
@xustis
@xustis Жыл бұрын
Ty for video, i am not sure why if i search information about thisi find difefrent info on all sites. For example in this site we can see in the structure core, and uses cases but the most common structure is application and domain. I don't understand why microsoft don´t have a profesional template and maybe with examples and important thinks.
@omidkarami4312
@omidkarami4312 2 жыл бұрын
Hi Steve, thanks so much for the amazing video, what is the best way to contact you for consulting?
@evaldasraisutis3058
@evaldasraisutis3058 3 жыл бұрын
You say Core shouldn't have dependencies beyond shared kernel, but to implement specifications in the core project, you then have a dependency on a nugget package that provides specification abstraction, right? I realize it's a bit of give and take, but how would you navigate that decision in a new project?
@steve-ardalis-smith
@steve-ardalis-smith 3 жыл бұрын
This is a common question and sorry I didn't cover it better in the video. If you have pure code dependencies in Core or Shared Kernel, you can include them either directly within the project(s) or as NuGet references. Examples of pure code dependencies would be things like guard clauses, specifications, repository abstractions (not implementations, typically), fluent validations, etc. Basically, any dependency that simply runs in process and doesn't talk to external infrastructure concerns should be fair game.
@michaelvman
@michaelvman 3 жыл бұрын
@@steve-ardalis-smith I think Evaldas has a good point here as your specifications do have implicit knowledge of the underlying infrastructure. In your example project ProjectByIdWithItemsSpec uses the extension method Include from your Specification nuget. Use of this is obviously motivated by the knowledge EF is being used as the ORM. Of course IQueryable isn't a perfect abstraction and something like this isn't easy to reconcile with Clean Architecture, so definitely some give and take.
@steve-ardalis-smith
@steve-ardalis-smith 3 жыл бұрын
@@michaelvman It's true my Specification abstraction includes support for a .Include which can then be mapped to an EF/EF Core .Include, I'll grant that. But it's not specifically coupled to either of those frameworks (in that package - there are separate packages that are specific to EF/EF Core), and the use of .Include might be applied to other stores as well (imagine an OData backend or GraphQL building out an object graph, etc.). So, yes, I did purposefully choose to include features in my abstraction that easily mapped to my (current) implementation (because why make it hard?), but that doesn't mean I'm tied to the implementation.
@michaelvman
@michaelvman 3 жыл бұрын
@@steve-ardalis-smith I think you hit the nail on the head, why make it difficult and that's why there is some give and take. And I agree you're not coupling your specifications to a specific data store. All I'm suggesting is it's impossible for your business logic to be 100% ignorant of infrastructure concerns which is what Clean Architecture tries to aim for. Your Specification nuget allows you to use EF/OData/GraphQL features without directly coupling your business logic to those frameworks but you're still implicitly aware of how they expect to work and that's the compromise, albeit not a big one. I would be curious how elegantly specifications could be implemented when working with a data store that didn't use a LINQ interface. I'm guessing it wouldn't be possible and the heavy lifting would need to be done by a repository class. Anyway really like what you've done here and think I will try to use it as a starting point for my next project. Also very keen to give API Endpoints a spin, looks like a very promising approach.
@steve-ardalis-smith
@steve-ardalis-smith 3 жыл бұрын
@@michaelvman It is true that the LINQ-based Specification package I use (and maintain) works best with ORMs that support LINQ well. There have been efforts to apply it to Dapper and CosmosDB, for instance, that have met with limited success. The Specification *pattern* can still work with such back end stores and tools, but its implementation may need to change (for instance, if using Dapper, your specifications will likely contain raw SQL in them).
@mattferderer469
@mattferderer469 3 жыл бұрын
Links to the Resources Template: github.com/ardalis/CleanArchitecture eShopOnWeb Sample: github.com/dotnet-architecture/eShopOnWeb Architect Modern Apps .NET Azure eBook: dotnet.microsoft.com/learn/aspnet/architecture
@nickfotopoulos5323
@nickfotopoulos5323 3 жыл бұрын
Thanks!
@saeedtalib8358
@saeedtalib8358 3 жыл бұрын
Thank for the time and help
@UndersVzLOM
@UndersVzLOM 2 жыл бұрын
Very helpful. Where can i read more on those repository, it's base class and specifications? Thanks
@Siuari1
@Siuari1 2 жыл бұрын
So, if i have to implement a TokenService that has external dependencies like microsoft jwt packages, for exemple. My question is: Will it go on infrastructure?
@activoutdavid
@activoutdavid 2 жыл бұрын
If the tokens is used in Infrastructure for calling an API then the TokenService also belongs in Infrastructure. Tokens are probably not part of the Domain/Core.
@waymanharris1284
@waymanharris1284 3 жыл бұрын
#Support #Awesome This is the most helpful youtube video I watched all year.
@tarasstrypko8160
@tarasstrypko8160 3 жыл бұрын
1. Why use custom exceptions if we can propagate Error result from operations? The problem I see with exception, that flow is a bit implicit, and sometimes it's not very easy to properly handle such exceptions. As in different places same exception could mean different things from application perspective. As an example: throw custom exception in entity constructor, have a generic handler, which catches it and maps to 400 response, which sounds not so bad, when user tries to create that entity. But, what if that exception is going to be thrown when entity is being de-serialized from cosmos, for some other operation on it (corrupted data in db)? User will get 400, when 500 should be returned. 2. Not sure I understand, why do we need Repository Interfaces in domain layer? Why can't we have them in Infrastructure layer? We're anyway going to have some kind of application layer (in your case UI project), which will glue Domain and Infra layers together. Don't we? 3. Is it real the case, that Domain layer is completely independent from DB structure? As from my experience, it was pretty hard to achieve this due to some ORM limitations or similar. Might be, I was doing something wrong. 4. You mentioned that Core project is good for Validators like fluent validation. Do you use fluent validation in your domain model? As if it's about request DTOs, then it seems more like application layer concern, isn't it? Similar question for specifications - should domain layer care about queries? Why not put them into application layer close to appropriate use-cases?
@activoutdavid
@activoutdavid 2 жыл бұрын
1. Exceptions should be for exceptional cases. If you let a Cosmos exception propagate from Infrastructure, then you can't catch it in Web or Core because they don't know what Cosmos is. But if you wrap it in a "CorruptDataException" then you can catch it in Web and return a 500 :) 2. The Web layer should not know anyhing about the Infrastructure layer. It only depends on it to setup dependency injection. So any interfaces that are used by both Web and Infrastructure must be in the Core project. 3. Yes, if you work with clean architecture you create pure domain entities and only the Infrastructure project knows what ORM you are using and converts to and from the domain entities. But you could decide to let it leak a bit into Core in your application :) 4. If you think about it, validation is actually business logic.
@primelimitt
@primelimitt Жыл бұрын
why is this not called Domain Driven Design with asp.NET Core 6? I m new to all these and it's really hard to understand what's clean architecture and what's DDD.
@ahadporkar7355
@ahadporkar7355 3 жыл бұрын
Thank you Smith for great explanation, it's been a great help with Clean Architecture.I understand a bit better now where and how these things are handled.
@konoko-o3o
@konoko-o3o 2 жыл бұрын
Awesome content, thank you!
@clashclan4739
@clashclan4739 2 жыл бұрын
For complex problem give simple solution. I have seen in the name of ddd/onion/hexagonal architecture ppls tends to makes project complex to work and modify
@pedrocosta8658
@pedrocosta8658 3 жыл бұрын
Just downloaded your template, a few questions: Why do we import the infrastructure project and not the Core project in the Web project ? Also how can we call the IToDoItemSearchService interface from Web if it is defined in Core and we don't import that project in Web ? Sorry for the confusing phrasing 😅
@pedrocosta8658
@pedrocosta8658 3 жыл бұрын
i think i understand now. We do import Infrastructure because we need to add the implementations to the dependency injection container and that would be impossible without importing the project in which the implementations are. Also we import Core, it's just not appearing in the dependencies tab in my project, but we're making "using ..... core" in some pages so yeah
@c-sharptricks9899
@c-sharptricks9899 2 жыл бұрын
ls this architecture good for microservices? please respond anyone who have used it or can provide a best link for that purpose. Thanking you in advance..
@ADSNGreenLife
@ADSNGreenLife 2 жыл бұрын
What about If I want to create Microservice and inject it where should I do that? Can we have Angular template with clean architecture ?
@activoutdavid
@activoutdavid 2 жыл бұрын
You can implement a microservice according to Clean Architecture. If you are calling other microservices you do that from the Infrastructure project.
@ADSNGreenLife
@ADSNGreenLife 2 жыл бұрын
@@activoutdavid thanks David for clearification.
@ADSNGreenLife
@ADSNGreenLife 2 жыл бұрын
@@activoutdavid How about If we want to host on azure. Few are Azure Function and Rest api then are we going to publish separate in projects and host it? is it so ?
@alpsavasdev
@alpsavasdev Жыл бұрын
what does ardalis mean?
@rahulsen002
@rahulsen002 3 жыл бұрын
Under what situation will I ever use SQL lite in an environment, SQL server in another and cosmosdb in prod
@RajaKajiev
@RajaKajiev 2 жыл бұрын
1 - local dev testing, 2 - prod on premise, 3 - cloud-hosted deployment ?
@turn1210
@turn1210 2 жыл бұрын
Yeah, that sounds like an accent waiting to happen
@acp3012
@acp3012 2 жыл бұрын
I have a question, I am developing 3 microservices which is part of an application. There is a situation we use common functionalities acroess each project/layers. For example Exception handling and Entities can be used in multiple microservices. My question is where can we keep this common libraries in Clean architecture?. Do we need to have another layer that hold only common functionalities?. if we are going to have separate library then CORE, API, INFRA all layer may depend on the common library.
@activoutdavid
@activoutdavid 2 жыл бұрын
Try to reduce dependencies if you can so that each microservice can be deployed as independently as possible. I think that if you have the same entities in multiple services you should consider merging the services or slicing them differently so that they don't need to share entities. For example do not share a single database between multiple microservices. Or maybe you can actually just copy shared classes between projects.
@wilfredogutierrez1640
@wilfredogutierrez1640 3 жыл бұрын
Thank you for sharing, very useful
@sweeperq
@sweeperq 2 жыл бұрын
What do you do when you have items in your domain that depend on Identity Users? For instance, an e-Shop may have an Order table with a reference to the User Id that placed the order. If I want to view all of the orders for a single user that works just fine *var orders = await context.Orders.Where(x => x.UserId = 10).ToListAsync()*. However, if I want to show a list of orders with associated user details (name, email, etc), all of a sudden I have 1 + N queries because the Identity User is in the Infrastructure class and our other entities cannot reference it. For instance, we cannot do _var orders = await context.Orders.Include(x => x.User).Where(x => x.User.LastName = "Anderson")_ because introducing User would create a circular dependency between the Domain and Infrastructure layers.
@hakoningvaldsen8046
@hakoningvaldsen8046 2 жыл бұрын
You can not in any way depend on Identity User in Infrastructure from Core. You would need to have an Interface in Core representing the Identity and let Infrastructure implementation map and inject into Core. You could then replace your Identity system completely, as long as the new system can map to and honor the Interface of Identity in Core. This is the whole point, and where the cleaness comes from.
@Ardalis
@Ardalis 3 ай бұрын
For raw queries I would typically avoid trying to use the domain model (which is built for mutations/updates) and instead just execute a database query directly. In many cases the identity information will be on a separate database or somewhere else entirely (for instance, Okta, Azure Entra, etc) so it may make sense to have a local *materialized view* of the user information you wish to display, which is periodically updated from the actual source.
@MaxBeresnev
@MaxBeresnev 3 жыл бұрын
Thanks for cool presentation and template!
@jaanustilk2769
@jaanustilk2769 3 жыл бұрын
So Web actually depends on Infrastructure not on Core. I dont see this as a problem but I dont understand why this is not clearly stated in the video.
@pedrocosta8658
@pedrocosta8658 3 жыл бұрын
but do you understand why ? I mean in the Web project we wanna call business methods, not infrastructure right ?
@activoutdavid
@activoutdavid 2 жыл бұрын
Web depends on Infrastructure because it needs to setup dependency injections for Infrastructure. But it may not call directly into Infrastructure :)
@dotnetlearnyourself2298
@dotnetlearnyourself2298 2 жыл бұрын
Nice Video
@diligencehumility6971
@diligencehumility6971 3 жыл бұрын
Is it doable to use this pattern with Azure Functions?
@mart0347
@mart0347 3 жыл бұрын
Yes. If you are using DI with your function then you may use CQRS.
@nateg247
@nateg247 3 жыл бұрын
I was thinking the same and somehow not completely convinced. Some concepts can be applied though
@diligencehumility6971
@diligencehumility6971 3 жыл бұрын
@@nateg247 I am not sure if Functions should be seen as microservices, and thus your functions have to communicate with each other. Which seems silly. Instead of having the data access in the stomach of your application. Was thinking using MediatR, and simply inject MediatR into the Functions projects. Is this doable?
@mart0347
@mart0347 3 жыл бұрын
@@diligencehumility6971 Yes!
@diligencehumility6971
@diligencehumility6971 3 жыл бұрын
@@mart0347 But doing it this way, my Functions project will have a reference to my Application project, which will be a DLL with all my functions. A single Azure Function is meant to represent one controller in traditional api right? So I might have a Product Functions project, which have get/post/delete/put methods for Products right?
@125Jackal
@125Jackal 3 жыл бұрын
Steve! How u doin? Just wanted to say that I love your courses in Pluralsight.
@burakgozen8932
@burakgozen8932 2 жыл бұрын
Can anyone help me with migrations in this example?
@nickfotopoulos5323
@nickfotopoulos5323 3 жыл бұрын
| Links from the end of the video | ::Clean Architecture Template:: github.com/ardalis/CleanArchitecture ::eShopOnWeb:: github.com/dotnet-architecture/eShopOnWeb ::Architect Modern Apps with ASP.NET Core and Azure eBook:: dotnet.microsoft.com/learn/web/aspnet-architecture
@vinholiver6801
@vinholiver6801 3 жыл бұрын
Thanks
@nonamezz20
@nonamezz20 2 жыл бұрын
Where would you place a hosted service ?
@activoutdavid
@activoutdavid 2 жыл бұрын
The IHostedService or the BackgroundService are implemented either in the Web or the Infrastructure project depending on the circumstances, but that implementation can then use domain logic in Core.
@maksymkyian4920
@maksymkyian4920 3 жыл бұрын
It was great, keep doing what you doing guys =)
@gijduvon6379
@gijduvon6379 2 жыл бұрын
Sorry, but this template is really mess! Repository calls in controller, specifications, ifelses. Nothing clean found....
@nothingbuthardwork8336
@nothingbuthardwork8336 3 жыл бұрын
Did someone know what kind of tool he use for zooming and drawing the red arrows?
@bobmcbob4399
@bobmcbob4399 3 жыл бұрын
ZoomIt I believe.
@prendas52
@prendas52 2 жыл бұрын
that template works in VS code?
@Ardalis
@Ardalis 3 ай бұрын
Of course. It's just a solution file and projects...
@AleyCZ
@AleyCZ 3 жыл бұрын
I love this!
@angmathew4377
@angmathew4377 2 жыл бұрын
Hi Everyone, @here can I have some thing similar for Node.js and express?
@jayakumar2927
@jayakumar2927 2 жыл бұрын
your github roject shows always unloaded all projeccts
@HeitorGiacomini
@HeitorGiacomini 2 жыл бұрын
DotNetCoreWeb have a reference to Infrastructure. Why?
@activoutdavid
@activoutdavid 2 жыл бұрын
To setup dependency injection
@Ardalis
@Ardalis 3 ай бұрын
@@activoutdavid Yes, just for convenience. You can move composition root to another project if it really bugs you or you need to keep that separation "pure".
@ram62836
@ram62836 3 жыл бұрын
Why API contracts are not within core?
@kaasbaas9532
@kaasbaas9532 3 жыл бұрын
application logic != domain logic
@임진호-x4x
@임진호-x4x 2 жыл бұрын
Thanks
@clashclan4739
@clashclan4739 2 жыл бұрын
I totally disagree with aggregate root concept. There can be multiple scenarios i just have to crud on depended entity like order details without a need of aggregate root. Then why forcing it in the name of ddd
@Ardalis
@Ardalis 3 ай бұрын
Like all patterns, use it when it's useful.
@Tetsuro-s8p
@Tetsuro-s8p 2 жыл бұрын
Thanks for such interesting talk! But how in this architecture we should call business logic from webapi?
@Ardalis
@Ardalis 3 ай бұрын
Ideally business logic lives in Core/Domain project. Web API gets to it via Application Services or by sending messages (Commands, Queries) via MediatR which are handled in an Application or UseCases project. The application services/handlers use the domain model types along with persistence abstractions to do the work and persist any state changes.
@sergeiburtsev5712
@sergeiburtsev5712 3 жыл бұрын
The topic's architecture as I see it: let's have a big monolith in the center and surround it with some helper projects that will help it work somehow.
@steve-ardalis-smith
@steve-ardalis-smith 3 жыл бұрын
If you think a domain model with no dependencies on UI or data or other infrastructure is "a big monolith" then I could see how you might arrive at this conclusion. However, a domain model is, in fact, just a class library, not a monolith.
@rbp365
@rbp365 3 жыл бұрын
Clean Architecture Template: github.com/ardalis/CleanArchitecture eShopOnWeb Sample: github.com/dotnet-architecture/eShopOnWeb Architect Modern Apps with ASP.NET Core and Azure eBook: dotnet.microsoft.com/learn/aspnet/architecture
@M4tt1mus
@M4tt1mus 3 жыл бұрын
The examples of going with Clean in the beginning are just examples of general bad architecture or don't give you much. For example, Business Logic in the DB is frowned upon by all modern architecture approaches, no?
@pablocom
@pablocom 3 жыл бұрын
lovely tshirt xD
@pauloperovic5683
@pauloperovic5683 2 жыл бұрын
not using miscrosoft edge? ccc :P
@PhantomAxxaxxin
@PhantomAxxaxxin 2 жыл бұрын
Prefer Vertical Slice Architecture by Jimmy B.
@kostasgkoutis8534
@kostasgkoutis8534 3 жыл бұрын
Haha, love the T-shirt
@dmitrynenazhenko209
@dmitrynenazhenko209 3 жыл бұрын
I use Clean architecture for my project, it is a little bit different though and even less depend on each layer. However using Value Objects is a real pain in the ass. First of all if you create your domain model and use it as main entity you can only guarantee that your value objects will be validated during Insert/Update requests from front-end. If you are trying to build your domain entity from external dependency or even from database request you may not guarantee that your Value Object will match the data that you got and it will break with validation. If external service that you are relying on return you something that you are not expecting, your application will fail on the stage of building that Value Objects
@nyonor7314
@nyonor7314 2 жыл бұрын
Builder pattern в помощь?
@activoutdavid
@activoutdavid 2 жыл бұрын
I think that in this case you should have a separate entity (call it DTO or API Model if you want) in Infrastructure without the value objects, and then you write code to map from the infrastructure entity to the domain entity and handle validation errors.
@jamesmclachlan2234
@jamesmclachlan2234 3 жыл бұрын
Nodding yes for 29 minutes and 57 seconds :)
@duongkytruong
@duongkytruong 2 жыл бұрын
tks
@mishashins
@mishashins 3 жыл бұрын
I used ur architecture its hard but its funny
@Petoj87
@Petoj87 3 жыл бұрын
While I loved this, it was a bit rushed
@gibran800
@gibran800 3 жыл бұрын
Awesome!
@OeHomestead
@OeHomestead 3 жыл бұрын
Nice, but wow, that's really, IMHO, making things way too complex for normal projects.
@vasilymeleshko
@vasilymeleshko 3 жыл бұрын
Если честно, ничего нового, для солид решений это называлось платформенными сборками разделенными по зонам и уровням ответственности.
@botyironcastle
@botyironcastle Жыл бұрын
this is not clean arch this is technical layering
@rahulmathew8713
@rahulmathew8713 2 жыл бұрын
Your database and related should be a separate solution and a microservice else its not reusable . Now only your web app can call it. If I want a mobile app and thats wants to call the same dal then. Should I reinvent wheel again, wasting companies time for redoing whatever we did to build those db related things.
@yesubabu2880
@yesubabu2880 2 жыл бұрын
Great explanation..thanks for confusing me..did not explain well..But u r a good developer not a good presenter
@halivudestevez2
@halivudestevez2 2 жыл бұрын
is it clean? not for me :D
@Philinnor
@Philinnor 2 жыл бұрын
It's hard to trust someone not using dark theme.
@Ardalis
@Ardalis 3 ай бұрын
I normally do but not for presentations since light theme is often easier to see in different lighting conditions.
@DigitalNomadOnFIRE
@DigitalNomadOnFIRE 2 жыл бұрын
Fall into the pit of success LMFAO...
@andrewsoldan6050
@andrewsoldan6050 3 жыл бұрын
Overthought, overused, unnecessary complex, ugly - I hate today's IT after 20 years in the business. LOL
@ВиталийБулдаков-ш4э
@ВиталийБулдаков-ш4э Жыл бұрын
So bad I can't like it twice
@ShadowAimai
@ShadowAimai 3 жыл бұрын
So this is useful for those poor souls still using ASP.NET?
Clean Architecture with ASP.NET Core 7 | .NET Conf 2022
27:58
Clean Architecture with ASP.NET Core 9
27:01
dotnet
Рет қаралды 29 М.
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 20 МЛН
How many people are in the changing room? #devil #lilith #funny #shorts
00:39
Don't underestimate anyone
00:47
奇軒Tricking
Рет қаралды 27 МЛН
The Logging Everyone Should Be Using in .NET
15:34
Nick Chapsas
Рет қаралды 86 М.
Onion Architecture - Software Design Patterns Explained
11:57
Professional Programming
Рет қаралды 24 М.
Clean Architecture // deutsch
17:21
the native web GmbH
Рет қаралды 4,1 М.
107. Should I Focus on Blazor or ASP.NET Core?
12:39
IAmTimCorey
Рет қаралды 80 М.
62. .NET Framework vs .NET Core vs .NET vs .NET Standard vs C#
25:14
Understand Clean Architecture in 7 Minutes
7:02
Amichai Mantinband
Рет қаралды 120 М.
You are doing .NET logging wrong. Let's fix it
25:29
Nick Chapsas
Рет қаралды 174 М.
Is Asp.NET Core Better than Node.js
13:35
Gavin Lon
Рет қаралды 9 М.
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 20 МЛН