Use The New Way To Build Fast .NET REST APIs With Minimal Code And Configuration

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ม.ค. 2025

ความคิดเห็น • 18

  • @eliesamyoun1006
    @eliesamyoun1006 ปีที่แล้ว +1

    Hello Julio. Thank you for the wonderful video.
    Just wondering, in the end of the video we have the name validated and strictly required.
    What if we had another property called Description for example. And this value can be an empty string, how can we achieve this?

    • @juliocasal
      @juliocasal  ปีที่แล้ว

      Welcome! You just add that property to your DTO, without the [Required] attribute.

    • @eliesamyoun1006
      @eliesamyoun1006 ปีที่แล้ว

      @@juliocasal great! Thanks Julio 😊

  • @gibran800
    @gibran800 ปีที่แล้ว

    Great video! Just one question, if I want to use an ILogger in the controller actions, for example, I would have to pass it as a parameter as well?

    • @juliocasal
      @juliocasal  ปีที่แล้ว

      Yep, you can inject any service registered in the service container, either by yourself or by ASP.NET Core (like ILogger), as parameters.

  • @beni4366
    @beni4366 ปีที่แล้ว +4

    The reason may be that I'm used to controllers but the end result didn't seem to be more simple than the classical approach.

    • @juliocasal
      @juliocasal  ปีที่แล้ว +1

      Yes, things make more sense if you assume controllers never existed to start with. It takes some time until this new approach seems more natural to us folks used to controllers.

  • @davidfowl
    @davidfowl ปีที่แล้ว +2

    This is beautiful!

    • @juliocasal
      @juliocasal  ปีที่แล้ว +2

      OMG, thank you David! Was just watching your Build 2023 talk. You rock!

  • @megasuperlexa2
    @megasuperlexa2 ปีที่แล้ว

    what VS extensions for c# do you use?

    • @juliocasal
      @juliocasal  ปีที่แล้ว +1

      Just the default C# extension (marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) and the C# extensions one (marketplace.visualstudio.com/items?itemName=kreativ-software.csharpextensions)

  • @megasuperlexa2
    @megasuperlexa2 ปีที่แล้ว

    how did you generate .http file for your api?

    • @juliocasal
      @juliocasal  ปีที่แล้ว

      Did not generate it, created it by hand. More info: marketplace.visualstudio.com/items?itemName=humao.rest-client

  • @christianista
    @christianista ปีที่แล้ว +9

    To resume you copy all the code from controllers, to program.cs to have big mess. To clean, you create a class where you put all entrypoint. No thanks, I prefer something clean.

    • @juliocasal
      @juliocasal  ปีที่แล้ว +1

      Yea, it doesn't look like you get a lot when you already had the controller in place, but I'm loving the approach for new APIs. In any case, thanks for the feedback!

    • @marshallnyamadzawo8553
      @marshallnyamadzawo8553 ปีที่แล้ว +2

      I agree with you, I do not see the advantage of doing this, unless if you have a one liner quick implementation. Killing controllers and create 2 three more classes to achieve the same implementation doesn't make much sense ..

  • @surakshachoudhary2880
    @surakshachoudhary2880 ปีที่แล้ว

    How is this better though?

    • @juliocasal
      @juliocasal  ปีที่แล้ว

      It's very explicit and performs a bit better.