.NET 6 Minimal API Full Build

Поділитися
Вставка
  • Опубліковано 5 жов 2024
  • In this step by step video we perform a full step by step build of a .NET 6 minimal API. We also contrast and compare it with a MVC API to further understand the differences and similarities between them.
    Level: Beginner
    🌐 Links 🌐
    💾 GitHub Repository: github.com/bin...
    🤩 Patreon Site (Exclusive Member Benefits!): / binarythistle
    🎓 My other courses: lesjackson.net/
    📕 My Book: link.springer.....
    🌲 Linktree: linktr.ee/bina...
    🔗 Minimal API Tutorial: docs.microsoft...
    🔗 Custom Model Binding: docs.microsoft...
    🔗 MSSQL Download: docs.microsoft...
    ⏲️ Time Codes ⏲️
    PART 1 - INTRODUCTION
    01:05 Welcome
    02:48: Video Overview
    07:42 MVC Refresher
    10:36 ASP.NET API Architecture
    15:38 What’s “missing” from Minimal APIs?
    PART 2 - CODE BUILD
    19:47 Scaffold Minimal
    26:29 Package Dependencies
    28:25 Initialising User Secrets
    30:26 Setting up SQL Server with Docker
    39:30 Model & Dto Creation
    51:09 DB Context
    54:40 Connection String
    1:02:36 Migrating
    1:07:44 Repository
    1:23:37 Automapper
    1:29:52 Quick Controller Review
    1:34:08 1st minimal endpoint
    1:42:37 2nd Endpoint - get a single resource
    1:47:56 3rd Endpoint - create a resource
    1:58:03 4th Endpoint - update a resource
    2:03:21 5th Endpoint -delete a resource
    PART 3 - MVC COMPARISON
    2:06:52 Review of MVC Features
    2:08:21 Filtering & the Filter Pipeline
    2:14:15 Custom Model Binding
    2:20:39 Model Validation
    2:24:21 Patch Endpoint
    2:28:56 Wrap up and conclusions
    2:31:16 Credits
    PART 4 - WRAP & CREDITS
    10:24 - ASP.NE CORE MVC API
    2:24:31 - Supporter Credits

КОМЕНТАРІ • 106

  • @viniciusaugusto3761
    @viniciusaugusto3761 2 роки тому +17

    Absolutely marvelous. Just finished, thank you for the content all the way from Brazil.

  • @alekseymamontov5520
    @alekseymamontov5520 2 роки тому +11

    You have a wonderful way of explaining concepts. I have watched many, many other videos and none were nearly as clear as this one. Thank you so much!

  • @pratap4147
    @pratap4147 2 роки тому +8

    Awesome work as always, Most Underrated channel in whole Programming Community.

  • @sauravguha6500
    @sauravguha6500 2 місяці тому

    It has been two years since, the video has been provided. The relevancy of the tutorial is still strong. I only wish to add that support for filter has now been added to minimal api.

  • @francksebbah
    @francksebbah 2 роки тому +8

    Hi Les, I have followed your course about the entity framework and it was awesome. And I have a future project with mini APi. Thanks for sharing your knowledge.

    • @VinuP2023
      @VinuP2023 2 роки тому +2

      Can you please share me link for entity framework course by Les 🙏

    • @francksebbah
      @francksebbah 2 роки тому

      Hi @@VinuP2023, great course.
      Less demonstrate in 10 lessons the different ways for the CRUDPros:
      - The different stets about Migration and the more important: rollback
      - Minimal project: Task Manager.
      - Win Form. I don't know this type of programmation.
      Great courses.
      ua-cam.com/video/4_U7TQVGkgQ/v-deo.html

  • @moafify920
    @moafify920 2 роки тому +1

    I swear the best in the business, God bless you ! , from Germany

  • @AthelstanEngland
    @AthelstanEngland Рік тому +2

    Thanks an excellent summary. As a newbie to ASPNet and C# I find the whole MVC architecture very complex. The minimal approach, especially if you separate functional areas into different class files for clarity/maintenance, makes more sense and closer to the more 'traditional' coding I'm used to.

  • @vincentverweij1053
    @vincentverweij1053 2 роки тому

    Have received the notification and am already excited to watch this video. So not look yet, but I know it will again be a decent one. Thank you Les

  • @danielconde2729
    @danielconde2729 2 роки тому

    The way you explain things is amazing. Thank you for the tutorial

  • @kamransadiq2172
    @kamransadiq2172 2 роки тому +1

    Really impressive neat and clean work. Thank you for the content all the way from Pakistan.

  • @NigelStratton
    @NigelStratton 2 роки тому

    Excellent content. Thanks so much. Love the little sign, perfectly positioned over your left shoulder, that's a very nice touch but I think the light for your face is a little bright.

  • @petershetematjila7633
    @petershetematjila7633 2 роки тому +1

    Les is the best. Thank you Les you've taught me so much.

  • @aubreemeng4583
    @aubreemeng4583 7 місяців тому

    Fantastic tutorial! An incredibly helpful and thorough lesson. If you're looking to acquire the skills to construct a backend API, this is an excellent resource. Many thanks, Les! Your efforts are truly appreciated.

  • @randolphdomingo5056
    @randolphdomingo5056 2 роки тому +2

    And Kudos to this video! It is a really good help to understand minimal APIs.

  •  2 роки тому

    Thanks for this video! It's time well spend to get a good overview about Minimal API!

  • @hernanfernandeztapia8897
    @hernanfernandeztapia8897 2 роки тому +1

    Amigo, no sabes cuanto agradezco tus videos, muy pero muy buenos!! Saludos desde chile

  • @suiteyousir
    @suiteyousir 2 роки тому +1

    Thank you for this meticulous walkthrough, just what I needed

  • @CallumBradbury
    @CallumBradbury 2 роки тому +4

    If you're making an API, the JSON absolutely is the view, it's the user interaction with the API - how they see it. If you're designing an API for others to consume, it's important to think of it that way, to ensure you keep it as clean and easy to use as possible.

  • @RayChristian
    @RayChristian 2 роки тому +1

    Another great tutorial. Thanks Les for your contribution.

  • @osahonighodaro9018
    @osahonighodaro9018 2 роки тому +1

    Many thanks to you for this. Full of content as usual

  • @codeWimran
    @codeWimran 2 роки тому

    This is the kind of channel I'm looking for🤗🤘

  • @andreistelian9058
    @andreistelian9058 2 роки тому

    Damn, I was just thinking when you will. Make a new video and here it is. Thank you Las, as always. You do a great job and may God bless your kind hearth

  • @ashimov1970
    @ashimov1970 2 роки тому

    Been to Melbourne back in 2007. An awesome city. Greetings of peace from Astana 👋👋

  • @Dmitry-Moiseenko
    @Dmitry-Moiseenko 2 роки тому

    Les, thank you very much!
    Video was really helpful.
    Best wishes from Ukraine!

  • @Sad-Lemon
    @Sad-Lemon 2 роки тому +1

    I see Les(s) I give like.

  • @gabrielmorenocaparrozsoare7619

    Hello LJackson. Tks a lot for the video!
    I'm a new dev VS-C# guy 🧑🏻‍💻😄. I have 2 question about VS Minimal API:
    1 - How usually do you run in production mode, the minimals api? as a windows service to run in brackground?
    2 - Is it possible turn a VS minimal api as a Windows Service since a Visual Studio and use a Setup Windows Project to install this minimal api in the customers as a windows service?

  • @MichaelEKaz
    @MichaelEKaz 2 роки тому

    Thank you for this very helpful demonstration.

  • @unrelatedchannelname4630
    @unrelatedchannelname4630 Рік тому

    Amazing communicator

  • @bernardmills4575
    @bernardmills4575 2 роки тому

    Thanks Les. Enjoyed that.

  • @elvissibetyu7228
    @elvissibetyu7228 2 роки тому

    Thank you Les, I learnt a lot

  • @babakbahrami3384
    @babakbahrami3384 2 роки тому

    Thanks Les, you're also an expert teacher 👌

  • @franksieckmann1221
    @franksieckmann1221 10 днів тому

    Les is really more ... thank you

  • @manliomarchica4911
    @manliomarchica4911 2 роки тому

    I'm at half of the video so far so good. I have just switch to Postgres as I develop on Linux based machine ( Manjaro ) and migration gave me platform unsupported exception

  • @tedm8492
    @tedm8492 2 роки тому

    Fantastic...Thank for the another great video Les!

  • @krisztianlun3463
    @krisztianlun3463 2 роки тому

    Fantastic! Thank you Les!

  • @khanfaizan05
    @khanfaizan05 Рік тому

    Awesome content 👍... @les can you please tell me the complete trending roadmap for becoming a .net software engineer ..

  • @user-tt6nc6mo7k
    @user-tt6nc6mo7k 2 роки тому +1

    Hey Les, thanks for the video. I would appreciate a video building a real app. You are an excellent teacher. But most of your videos are from a technology perspective whereas I feel a video showing how you'd approach a real world application from start to finish would be great. Maybe something like a real-estate listing platform? A social media site?

  • @onurozguzel8747
    @onurozguzel8747 2 роки тому

    Many thanks for this valuable information! Best wishes! :)

  • @GeminiLearning
    @GeminiLearning 2 роки тому

    Thanks Les for the informative video

  • @ThisIsSimonK
    @ThisIsSimonK Рік тому

    Your content is super accessible and very useful, thank you for your hard work!

  • @Khurr
    @Khurr 2 роки тому

    Had me at the intro music...a good beat to hype you up before you start practicing "Les is Mour"

  • @Moosa_Says
    @Moosa_Says Рік тому

    Really a great tutorial. Thanks for this :)

  • @timcampbell4045
    @timcampbell4045 2 роки тому

    I had a weird issue where the ef migration errored with a "primary key not defined" issue on Command despite the [Key] attribute being applied. In the end I removed the attribute as ef assumes something called "Id" is the key and that worked! Very strange, posted as I thought it might help anyone else who has the same problem. Note: your version on Git that has the attribute does work!

  • @vladyslav.papirnyi
    @vladyslav.papirnyi 2 роки тому

    Thank you for video. It is really interesting as usual

  • @craigmcloughlin9361
    @craigmcloughlin9361 2 роки тому

    Great Video Les 👍

  • @babakbahrami3384
    @babakbahrami3384 2 роки тому

    That was awesome, great job

  • @AlejandroVivas
    @AlejandroVivas 2 роки тому

    Hi man, thank you for sharing!

  • @imtiajahammad3586
    @imtiajahammad3586 2 роки тому

    Thanks for the awesome introductory tutorial.. But I would appreciate more if the voice audio could more clean and loud.

  • @hemantnavarkar955
    @hemantnavarkar955 2 роки тому

    Great content. Thanks Les.

  • @asmi06
    @asmi06 2 роки тому

    Good stuff! Just a little nitpick on terminology - "model" in MVC implies domain model, and so includes all business logic, including persistence. What you call "model" is a data model, which is a part of domain model, but latter also includes all allowed operations, and basically is a model in the scientific sense - as a "simplified representation of a real world phenomenon".

    • @chillydill4703
      @chillydill4703 2 роки тому

      Yeah, good stuff indeed! Oh, didn't know that! Do we use "model" as you mention as well as "data model" when we draw the architecture? Or is it kind of interchangeable if that makes sense?

    • @asmi06
      @asmi06 2 роки тому

      @@chillydill4703 I perfer to call it a data model when implementing web API because that's what it really is. In the non-so-recent past it was common to place logic into a separate layer (conventionally called "business logic layer"). This is not that common nowadays as business logic is often placed into services or even repositories, so that entire web API project is essentially a domain model. I'm a big fan of using precise terminology when possible because it makes reading the code easier (and code is read much more often than it's written in most LOB applications), so I typically call data access-related stuff a data model (because that's what it really is if you think about it). But I also use IQueryable to build custom LINQ queries from within services (so my repositories tend to return IQueryable such that services can further specialize queries before they were actually sent out to DB), and as such it's not easy to cleanly separate DB layer from services either. But since that brings about many advantages (like projections which allow only retrieving columns you actually need instead of blanket-all columns, or dynamic LINQ queries instead of a million of repository methods like GetEntitilesWhichFullfilConditionsSetNumber42), I'm OK with such a "leaky" abstraction.

  • @geojaya
    @geojaya 2 роки тому

    Great Presentation, put a beginner at ease. question - can we use User secret in production - is that information encrypted

  • @randolphdomingo5056
    @randolphdomingo5056 2 роки тому

    Do you have a video for MVC? I'm keen to watch on that. Thanks!

  • @soldevhelp
    @soldevhelp Рік тому

    Hi Les loving your work, Which part of Scotland are you from I'm rom Fife

  • @chetangupta7737
    @chetangupta7737 2 роки тому

    @Les, I see you have videos around EF however they are quite old. May I ask you to create a video on EF Core 6.0? Thanks!

  • @EMWMIKE
    @EMWMIKE 6 місяців тому

    good video , however regarding repository. I know that you can swap out your db context and whatever. But frankly how often has that ever happened.

  • @vktop2
    @vktop2 2 роки тому

    Nice video!, Does minimal API work in all cases? If not, in which cases does the Minimal API work and in which cases should it not be used? Thanks

  • @guincode
    @guincode 2 роки тому

    your videos on dotnet graphQl helped me a lot. I have created a dotnet graphQL api, and an angular application that consumes this api....
    I am currently trying to publish my graphQL api on iis serve on windows...
    I'm trying to publish my graphQL api on iis serve on windows... Did you already talk about this subject? if yes you can give me the link, if not you can redirect me to a resource that can help me

  • @surajkumarpradhan667
    @surajkumarpradhan667 2 роки тому

    Awesome video . Please bring in more videos related to Azure.

  • @abhishekborikar4958
    @abhishekborikar4958 2 роки тому

    Which one is better to use Dapper or EF Core ? I have browse through many articles over internet but didn't get much clear idea over it. What are the different best scenario to use EF Core and Dapper ?

  • @CHERANGA123
    @CHERANGA123 2 роки тому

    Love this!

  • @v4raziel
    @v4raziel 2 роки тому

    Excellent!

  • @moafify920
    @moafify920 2 роки тому

    i really wish for Angular video too :D

  • @MrStevenKPuckett
    @MrStevenKPuckett Рік тому

    Had a trust issue running the ef update command. Added "TrustServerCertificate=True" to the end of my connection string in the appsettings for a quick fix

  • @shanksatutube
    @shanksatutube 2 роки тому

    Thank you Les. This is fantastic. Just a quick thingy... is it just me or is the code blurry in the video itself?

    • @Xoundz
      @Xoundz 2 роки тому

      Use higher resolution in video settings. Default 360 causing blurry video.

  • @slbmonitor5626
    @slbmonitor5626 2 роки тому

    Is there a reason you use visual studio code instead of Visual studio 2022?
    Also could you explain how newton Json would work with sub classes?

  • @shilpa123
    @shilpa123 8 місяців тому

    What is the use of orchestrator application?

  • @tommcmeekin1
    @tommcmeekin1 Рік тому

    Got an error with the sql connection string. Adding "Encrypt=False;" solved it for me.

  • @pankajsaxena7902
    @pankajsaxena7902 Рік тому

    Hi Les, I just purchasing a course on your site but getting issue on the payment related on both via Paypal and others.

  • @mouradaissani8957
    @mouradaissani8957 2 роки тому

    Thank you about the great content

  • @piotrjan2927
    @piotrjan2927 2 роки тому

    .Net6 minimal API endpoints look very similar to route handlers in node.js-express.

  • @rockey4474
    @rockey4474 2 роки тому

    Thanks to Share..

  • @kaleemanwar2124
    @kaleemanwar2124 Рік тому

    What is the purpose of AppDBContext class?

  • @rhetonic1
    @rhetonic1 2 роки тому

    If only there was a way to subscribe again.❤❤❤❤❤

  • @codeme8016
    @codeme8016 Рік тому

    I feel in order to skip every single simple Controller I have to add a lot of extra codes/files in order to achieve the same thing. e.g. validating data.
    What's the point of using Minimal API now? Am I missing something?

  • @codewithstephen6576
    @codewithstephen6576 2 роки тому

    Is it correct to say MVC API or just REST API?

  • @danishiqbal3608
    @danishiqbal3608 2 роки тому

    Hi hope you're all good and fine . I'd like to ask you that could you teach us how to connect two distinct machine via one single ip address and could exchange the message btw them ? Please let me know from your end. Thanks

  • @wooseok5688
    @wooseok5688 2 роки тому

    Uhhhh :( una semana antes que saliera está nueva versión me registre con mi credencial de estudiante para la licencia, puedo tener acceso a esta versión o ya valió? Jaja

  • @igorr4682
    @igorr4682 Рік тому

    Feels and looks more like a Node js with Express framework

  • @fdk9913
    @fdk9913 2 роки тому

    Hi, great video. However, I had an issue with calling the docker-compose up -d command on terminal. I keep on getting phrases like " Running 0/640 Downloading [================ - sqlserver Pulling" line after line, and never stopping. Do you have any tips to fix this.

    • @Enterprise-Architect
      @Enterprise-Architect 2 роки тому

      Docker executable has not been granted permission to access internet; hence it's not able to reach repository to pull the required images... You may like to run in elevated mode to see if gets bypassed...

  • @FlavioAugustoToldo
    @FlavioAugustoToldo Рік тому +1

    start coding at 19:47

  • @kranchoo
    @kranchoo 2 роки тому

    Ace content 

  • @ofuochi
    @ofuochi 2 роки тому +1

    Is it a coincidence that his name is also Les?😂

  • @stevekurtz6676
    @stevekurtz6676 Рік тому

    Currently stuck on the migration process and am receiving this error: Microsoft.Data.SqlClient.SqlException (0x80131904): Login failed for user 'pa55w0rd!'. Has anyone run into this issue/resolved the error?

  • @JamesOfKS
    @JamesOfKS Рік тому +1

    Also, Les is more.

  • @quochoantran6771
    @quochoantran6771 2 роки тому +1

    👍👍👍👍👍

  • @tabinjohjamvalerymukom9049
    @tabinjohjamvalerymukom9049 2 роки тому +1

    i am here

  • @norbertabone9157
    @norbertabone9157 2 роки тому

    Tim Corey's look alike .

  • @softw.netcore7521
    @softw.netcore7521 Рік тому +1

    👏✍👌👏

  • @porterneon
    @porterneon 2 роки тому

    please use quiet keyboard when recording ...

  • @leonid_konoplin
    @leonid_konoplin 2 роки тому

    Постарел Лес

  • @sinafallahpour2626
    @sinafallahpour2626 2 роки тому

    ommm

  • @FreeDom-id6yb
    @FreeDom-id6yb 2 роки тому +2

    I wonder why developers have such egos...they must only be validated by the computer skills because there is this GUI called package manager but they like to confuse newbies to make it look like they are skilled because they use terminal. also the nice and easy way to use sql server is by using sql server without the container....weird. I think the concentration should be teaching and typing as little as possible and showing the newbie the tools within VS like nuget package manager and not concentrate on terminal so they can learn more about creating this api than having to learn terminal. Its distracts and takes away from what the real goal is. It's the same reason VS should be used and not an advanced tool for compiled programs like Code.

    • @vohbovohborian28
      @vohbovohborian28 Рік тому

      I agree with this. If you have to say "oh I have a tutorial for this" like 10 times in a beginner tutorial video then something is wrong.
      I mean I understand WHY things are done in the way you are used to, and using tools to make it "easier" can be useful, but it undermines teaching the understanding of what is actually happening.

  • @europauniversalis5406
    @europauniversalis5406 2 роки тому +1

    Just a tip for anyone stuck getting the db to work. I had to add SA_USERNAME: "sa" to the docker-compose file before it would let me log in with the sa account.

  • @hariharpadhi2304
    @hariharpadhi2304 Рік тому

  • @cryptoeric24
    @cryptoeric24 Рік тому

    Had to add: TrustServerCertificate=True; to the connection string in appsettings.json to add the database

  • @DickBakerSql
    @DickBakerSql Рік тому

    At offset 43-46 mins Les show the csproj nullable enable [good], but then wimps out by making nullable string? datatype [BAD] which is horrible and does not represent actual usage. Better to write property assignment to satisfy the analyzer warning, e.g. string Name {get;set;}=default!; which may be ugly but explicitly specifies intent that the property is non-nullable (except by the actual property assignment itself!).
    EFCore also respects that property is non-null even without any explicit [Required] attribute, any any code that combines [Required] and string? should be a red-flag code-smell to developers.
    Final plea is that Les should adopt file-scoped namespaces to regain horizontal coding palette (handy when viewing on narrow mobile devices).

  • @gabrielmorenocaparrozsoare7619

    Hello LJackson. Tks a lot for the video!
    I'm a new dev VS-C# guy 🧑🏻‍💻😄.
    I have 2 question about VS Minimal API:
    1 - How usually do you run in production mode, the minimals api? as a windows service to run in brackground?
    2 - Is it possible turn a VS minimal api as a Windows Service since a Visual Studio and use a Setup Windows Project to install this minimal api in the customers as a windows service?
    Many Thanks!

  • @danishmalak1520
    @danishmalak1520 2 роки тому

    Fantastic!