CRUD REST API With Clean Architecture & DDD In .NET 7

preview_player
Показать описание

REST APIs are the industry standard when it comes to building APIs. There are many nuances to building a good API, and it becomes more complicated in a Clean Architecture & DDD-styled system. So I'll show you how to make a set of CRUD endpoints and some of the REST API best practices you should consider.

Join my weekly .NET newsletter:

Read my Blog here:

Subscribe for more:

Chapters
0:00 The Entity and EF configuration
2:05 Create endpoint (POST)
8:48 Delete endpoint (DELETE)
15:16 Update endpoint (PUT)
22:42 Read endpoint (GET)
Рекомендации по теме
Комментарии
Автор

Wow, so concise and info packed! Great video once again. Keep up the great content.

It would be really cool to see a follow up that adds you typical features that you mentioned in your post yesterday, like logging, stylecop/sonar, etc and what that refactor process looks like.

silvertek
Автор

I did not watch whole 30 min video in 8 minutes from release, but I already know this is exacly what I was waiting for :)

Speede
Автор

I want you to please become my mentor, I really wanna learn programming from you.
The way you code just like that it's nothing, and that's what makes it unique

muhammadaousaja
Автор

Yes, I do it exactly like you are showing here. Only difference is that I have a separate project for my application contract (Commands, Queries and DTO/responses) in case there is more than one way to use my application (1 via API, 2 via events/scheduled tasks, etc.), so the users of the application only need to reference those contracts and mediatR takes cares of the rest.

pablolopezponce
Автор

Happily supporting you via Patreon because of the quality content that you continue to provide. Great job Milan!

mikekidder
Автор

Excellent explanation! Can you please make a video regarding Unit of Work? I’ve seen this approach being used so many times

MrSkoban
Автор

I'd love to see a next video that refactors out the use of throwing exceptions and using the ErrorOr library instead. :) Yes, I hate using exceptions for flow control.

pilotboba
Автор

The video is great overall but I have some questions as well.
Where do I put the logging in DDD and also the retry mechanism when doing async task.

KhoaHuynh-vcdj
Автор

Hi Milan, great video, at 0:25:19 you mention that repositories are less performant. Why is that and is it much of a difference.

shanebrannick
Автор

Why do you pass values into the constructor for creation instead of using a method like 'update'? Additionally, why not add another constructor for updating instead of using a method? Also, I want to mention that 'put' is used for full updates, so I would appreciate it if you could also add 'patch' for partially updating.
Thank you, Milan, for your efforts during this week. I have learned a lot from you

omarjamil
Автор

Hi Milan. I am currently working on a Microservices Based Architecture project and its pretty hard core and at the same time fascinating.
I like your architecting skills and would like to see if you start a video serious on architecting a scalable microservices based architecture where any new microservice can easily be part of the system via subscribing to Events for a given subscription name and topic and/or start producing new events for other services and that runs on Microsoft Service Fabric, have Multi Region Write and Cache Databases, Multi-region App Insights.

It will be challenging but fun to see how we add capabilities like importer jobs, automated migrations that are clean and scalable.

sidhantverma
Автор

Oh, it's what I've been waiting for :)

mavlonodev
Автор

As always great video! Thank yo very much!

ilyazakharov
Автор

I have a question, let’s say for example for your create command you receive an order with a list of orderItems, is it ok if I create the order and the orderItems in the same handler? Like I create the order call savechanges, then loop through the items

joshem
Автор

Why is the http PUT method used to update the resource, but not PATCH? The documentation says: PUT creates a new resource or replaces the representation of the target resource with the data presented in the request body. And you throw an exception if the resource is not found during the update.

modestb
Автор

You are the best, I make it a project to try to avoid using repository patterns. I use dbcontext directly on services to perform operations. So I think that hasn't be a bad idea. I think that all it's more simple. So I don't know what are the benefits of using repository pattern .

gerarduab
Автор

Thank you! Like always, amazing content!

saulolima
Автор

Appreciate your sharing. I have a concern that the Clean Architect is not suitable for microservice right? Microservice has its architect ure

tiendatniit
Автор

The product not found exception just seems like a quick and dirty way to implement validation. How would you go about removing the exception such that the flow is more straight forward? I would implement a delete product guid validator which would check that the product exists before sending the delete product command. However this can lead to issues if I forget to validate before calling the delete product command. What do you think?

crazyfox
Автор

Please make one video, how to upload files with the clean arch.

harisulislam