Use HttpClient Properly with HttpClientFactory With Named and Typed Clients in .NET

Поделиться
HTML-код
  • Опубликовано: 3 янв 2025

Комментарии • 23

  • @CodeMaze
    @CodeMaze  9 месяцев назад

    Thank you all for watching and for your support.
    ►► If you want to check out all our courses you can do that here: courses.code-maze.com/courses/

  • @cocacola7535
    @cocacola7535 4 месяца назад

    I like your videos.
    You keep showing texts explaining important concepts.
    It is very helpful to emphasize them.

    • @CodeMaze
      @CodeMaze  4 месяца назад

      Glad to hear that! Thanks for watching my videos.

  • @er.manojsingh7359
    @er.manojsingh7359 2 месяца назад

    Thanks for add this in series and it will be really helpful. Thanks

    • @CodeMaze
      @CodeMaze  2 месяца назад

      Glad it was helpful!

  • @luizgagliardi6614
    @luizgagliardi6614 23 дня назад

    Great video!
    When using the typed HttpClient, you did not use the HttpClientFactory. In that case, what's the point of injecting the HttpClientFactory?

    • @CodeMaze
      @CodeMaze  22 дня назад

      Thank you. I believe you think about the HttpClientFactoryService class. The HttpClientFactory just happened to be already registered there, and I used the same class to show how we can use the typed client.

  • @philipquarles4679
    @philipquarles4679 6 месяцев назад

    Hi Marinko, It's clearly explained and worked as expected. I was looking for something like this for a long time. However, my use case is slightly different. I need to protect my Azure function app instead of my WebApi. Do you have any thoughts?

    • @CodeMaze
      @CodeMaze  6 месяцев назад

      Hi Philip. First of all thanks for the kind words. I didn't work with Azure at all, well I did something small, but nothing more than that, so I hardly can help you with that.

    • @philipquarles4679
      @philipquarles4679 6 месяцев назад

      @@CodeMaze Thank you for getting back to me!

  • @NikolaGolijanin-m8s
    @NikolaGolijanin-m8s 9 месяцев назад

    Hi Marinko,
    is it better to configure your type client using action delegate while registering it or in constructor like you did? You are injecting http client inside CompaniesClient, i assume that is possible to configure base url and timeout inside program.cs while registering CompaniesClient.
    Best regards

    • @CodeMaze
      @CodeMaze  9 месяцев назад +1

      Hi. You can configure it inside the Program class, if you search through some of Microsoft's documentation, you will see they have similar examples. But, for me, it is always better to encapsulate that HttpClient configuration inside the typed client class, making the Program class cleaner with less configuration logic. Also, this is configuration strictly related to that specific client, so why not having it inside the typed client's class.

  • @I-PixALbI4-I
    @I-PixALbI4-I 9 месяцев назад

    Thx for video!

    • @CodeMaze
      @CodeMaze  9 месяцев назад

      My pleasure. Thanks for watching.

  • @andresbeltran5779
    @andresbeltran5779 9 месяцев назад

    Excellent 😬😬

    • @CodeMaze
      @CodeMaze  9 месяцев назад

      Thank you. Glad you like it.

  • @StefanLeshi
    @StefanLeshi 9 месяцев назад

    Great video

    • @CodeMaze
      @CodeMaze  9 месяцев назад

      Glad you enjoyed it

    • @StefanLeshi
      @StefanLeshi 9 месяцев назад

      @@CodeMaze i was curently workimg with http client and was looking how to optimize it so yeah this video made much easier , keep it up woth videos tnx.

    • @CodeMaze
      @CodeMaze  9 месяцев назад

      I am so glad to hear that. Sorry for the late response, didn't see your reply.

  • @10Totti
    @10Totti 9 месяцев назад

    Best Tutorial i use Tuyped Clients.

    • @CodeMaze
      @CodeMaze  9 месяцев назад

      Thank you very much. Yeah, I also prefer typed clients.