ASP.NET Core Web API Best Practices

  Рет қаралды 5,221

Code Maze

Code Maze

4 ай бұрын

►► Master Web API development Best Practices: bit.ly/3TnqoFQ
►► Build great web apps in Blazor WebAssembly: bit.ly/437g87T
►► Support us on Patreon and get the source code: / codemaze
In this video, I’m going to talk about what I consider to be the best practices while developing the .NET Core Web API projects. How to make them better and more maintainable. This is the opinion based on so many projects I developed throughout my developer career and working with many different clients.
You will find a lot of great advice in this video regarding project organization, controller and actions, different feature implementations, security, etc.
LINKS MENTIONED IN THE VIDEO
►► Onion Architecture - • Onion Architecture in ...
►► Global Exception Handling - • Global Exception Handl...
►► Action Filters - • Implementing Action Fi...
►► Versioning Web API - • How to Implement ASP.N...
FOLLOW US ON SOCIAL MEDIA!
►► / marinko-spasojevic
►► / codemazeblog
►► / codemazeblog

Пікірлер: 27
@CodeMaze
@CodeMaze 4 ай бұрын
Thank you all for watching and for your support. ►► If you want to master Web API development using best practices, check out our Web API book: bit.ly/3x75ZMM ►► Also, to build great full-stack apps with Blazor, check out our course: bit.ly/3Pw3Y33
@naughtyboy1974
@naughtyboy1974 4 ай бұрын
can i get this src code .i like that generic repository
@CodeMaze
@CodeMaze 4 ай бұрын
Hi. I am sorry, but I don't have it for this one. Basically, I would have to share an entire project from our book package, which is not fair for those who already bought the book.
@sruthisiddamseeti4618
@sruthisiddamseeti4618 4 ай бұрын
The video is informative. Concepts were clear.
@CodeMaze
@CodeMaze 4 ай бұрын
Thank you. I'm glad you liked it.
@Ca2le
@Ca2le 29 күн бұрын
This video need more likes!
@CodeMaze
@CodeMaze 28 күн бұрын
Thanks a lot. We will get there at some point :)
@rasikasamith
@rasikasamith Ай бұрын
Thanks
@CodeMaze
@CodeMaze Ай бұрын
You are most welcome.
@jalal_al-thahab
@jalal_al-thahab 4 ай бұрын
Thank You
@CodeMaze
@CodeMaze 4 ай бұрын
You're welcome
@kristiadhy
@kristiadhy 2 ай бұрын
At 9:56 and beyond you mentioned paging, filter, search, sort, etc. But I don't see such an implementation in your onion architecture repository. Do you cover that in another specific video/article? or is it only in your paid membership/content?
@CodeMaze
@CodeMaze 2 ай бұрын
I have a Paging video recorded. A bit older, but I have it here. But the full implementation of all the API features, Paging, Sorting, Filtering, Searching, Auth, HATEOAS, Data Shaping, etc... is placed in our Web API book which you can find in the description.
@kristiadhy
@kristiadhy 2 ай бұрын
@@CodeMaze Ok. I'll consider buying the course. I learned a lot from your resources, it's easy to follow. I think it fits me best. Thank you.
@CodeMaze
@CodeMaze 2 ай бұрын
Thank you too for the support. We have more than 5k people who purchased the book package and countles of great reviews, some of them were changing the job, some were applying for a new one, some just wanted to go over what they already know, but it prooved to be of great value to them. You can find some of the reviews on the sales page. Or take a look at the Gumroad's score mark.
@null3070
@null3070 Ай бұрын
Great explanation. Link to the repo? I don't find it even even as your Patreon sponsor.
@CodeMaze
@CodeMaze Ай бұрын
Thank you. I don't have a source code for this one only, when we talk about new videos. This is more of a retrospective of what I consider to be the best practices and also all the examples you see are from our Web API book, so I can't just share the entire book's code.
@null3070
@null3070 Ай бұрын
​@@CodeMaze thank you, your content made me buy the premium :) absolutely delighted with the content. Just wondering why you use different structures for the onion architecture that you propose. Even the names differ, sometimes you group the lower layer onto Entities and sometimes onto Domain.
@CodeMaze
@CodeMaze Ай бұрын
Hi. Thanks a lot for the support. Sorry for a bit later response... time zone :) To be honest I don't understand what you mean by a "different structures". Our book's second edition source code (from the end of the book where everything is over) has the same organization as you can see in the video. You bought the second edition, so this should be the same. In the first edition there were some differences. That's why we created a second one with a lot of changes and improvenments.
@kristiadhy
@kristiadhy 2 ай бұрын
Could you please share the reason why we shouldn't put any business logic in our controllers? I have learned to use your onion architecture repo example, but I take out the service layer and put business logic in the controller because I don't want my project to be too complex.
@CodeMaze
@CodeMaze 2 ай бұрын
Hi. To make the explanation simple, the controller should be just a bridge between the client using your API and your API's logic. You can look at your controllers as proxies responsible only for the request itself. So it should accept the request, if that request has a body, we can do a validation (but as you can see, you can move that away from the controllers as well) and then simply forward that request to the service layer. It should know nothing about the business logic. Once the service layer returns a result, the controller should simply notify the client about that. This is just a simple separation of concerns. Each layer has its job and it should be doing it well. Finally, the code is cleaner because business logic can explode pretty quickly and then you have a lot of mess in your controllers. Will it work, yes of course, but just because you can do it doesn't mean you should. Anyway, we are all architects of our apps and if you think this fits your needs perfectly, you can do that, I just don't think it is the right thing to do. Having a service layer will not make your solution complex, just as opposite. It will make it cleaner.
@kristiadhy
@kristiadhy 2 ай бұрын
@@CodeMaze Well explained, thank you
@CodeMaze
@CodeMaze 2 ай бұрын
You are most welcome.
@user-qq9yx1ux1w
@user-qq9yx1ux1w 4 ай бұрын
can you provide source code as well? thank you
@CodeMaze
@CodeMaze 4 ай бұрын
Hi. There is no source code for this one as all the examples are part of the source code from our Web API book. Basically all the code from the video are just snippets from the full project from our book.
@MaxKyivUa
@MaxKyivUa 4 ай бұрын
@@CodeMaze but where can i find this book?
@MarinkoSpasojevic
@MarinkoSpasojevic 4 ай бұрын
Hi @@MaxKyivUa Please check the description of this video. It is the first link there stating Our Book.
3 .NET "Best Practices" I Changed My Mind About
10:16
Nick Chapsas
Рет қаралды 101 М.
Super gymnastics 😍🫣
00:15
Lexa_Merin
Рет қаралды 108 МЛН
ОСКАР ИСПОРТИЛ ДЖОНИ ЖИЗНЬ 😢 @lenta_com
01:01
Learn Blazor: Build an Inventory Management System in .NET 8
2:17:34
Make Your LINQ Up to 10x Faster!
11:08
Nick Chapsas
Рет қаралды 53 М.
Background Jobs in ASP.NET Core
18:35
IAmTimCorey
Рет қаралды 46 М.
"Stop Using Async Await in .NET to Save Threads" | Code Cop #018
14:05
Don't Use Polly in .NET Directly. Use this instead!
14:58
Nick Chapsas
Рет қаралды 48 М.
Containerize Your C# Application Easily with the .NET CLI
9:57
IAmTimCorey
Рет қаралды 35 М.
Repository Pattern In ASP.NET Core Web API
12:14
Code Maze
Рет қаралды 74 М.
5 Rules For DTOs
17:56
Ardalis
Рет қаралды 38 М.
Rest API - Best Practices - Design
15:50
High-Performance Programming
Рет қаралды 99 М.