gRPC Service with .NET 7

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.ย. 2024
  • In this video we build a gRPC service with 5 methods: Create, Read (single), List (multiple), Update and Delete. We then employ JSON transcoding (a new feature added in .NET 7) to allow our gRPC service to act as a REST based API. This allows web-based endpoints to consume our service, while at the same time continuing to allow native gRPC clients to consume as well.
    🌐 Links 🌐
    💾 GitHub Repo: github.com/bin...
    🎓 My other courses: lesjackson.net
    📕 My Book: link.springer.....
    🤩 Patreon: / binarythistle
    🌲 Linktree: linktr.ee/bina...
    🔗 Microsoft Learning: learn.microsof...
    🔗 DBeaver: dbeaver.io/dow...
    ⏲️ Time Codes ⏲️
    - 0:33 - Welcome
    - 2:00 - gRPC Overview
    - 5:08 - Scaffold the prject
    - 9:58 - Test "greeter" service with Postman
    - 12:32 - Add package dependencies
    - 14:48 - Create the Model
    - 16:38 - Create DB Context & migrations
    - 22:37 - Define the protobuf file
    - 32:39 - Build the first service method
    - 40:55 - Test method with postman
    - 42:52 - Read method
    - 48:42 - List method
    - 52:39 - Update method
    - 59:14 - Delete method
    - 1:03:24 - Add the annotation files
    - 1:06:07 - Annotate the first gRPC method
    - 1:09:26 - Annotate remaining methods
    - 1:12:42 - Test with Postman
    - 1:16;00 - Patreon supporter credits

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

  • @pavankumard5276
    @pavankumard5276 หลายเดือนก่อน +3

    Good video, I wish there was an example to show how two microservices could communicate with eachother using Protobuf

    • @Saidkus
      @Saidkus 17 วันที่ผ่านมา

      that would be great ...

  • @ViV.PakPak
    @ViV.PakPak 5 หลายเดือนก่อน +1

    깊이있고 아름다운 강좌, 함께할 수있어서 기쁘게 생각합니다. 오랜만에 찾아뵈었군요.. 늘 감성있는 목소리에서 전달하시려는 내용이 잘받아들여집니다. 다시한번 좋은 강좌에 감사드리며, 늘 건강하시고, 행복과 함께 일상에 늘 행운이 가득하시길 바랍니다. 감사합니다.

  • @adhamelsharkawy_79
    @adhamelsharkawy_79 ปีที่แล้ว +6

    Welcome back Les, and thank you for your efforts

  • @eugene-dmitrievich
    @eugene-dmitrievich 9 หลายเดือนก่อน +2

    Thank you so much for this video! Interesting explanation of gRPC, Protobuf, .NET, JSON transcoding

  • @highfive7281
    @highfive7281 10 หลายเดือนก่อน +2

    I love how you make advanced topics seem easy plus I love your accent.

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

    Hey Les, this was absolutely fantastic and I learned a ton. I wasn't able to get .Net 7 to work for me because HTTP/2 isn't fully supported on macOS. However, I was able to use .Net 8 Preview on macOS because HTTP/2 is fully supported. Thus, I was able to code along without changes. The JSON transcoding is super awesome and it was very easy to setup. I'll definitely be leveraging this in my projects. Bravo!!!! 🙌🏾👏🏾👍🏾🔥

  • @adrianoverbury4949
    @adrianoverbury4949 ปีที่แล้ว +5

    Love this video. I've had an eye on gRPC for some time now, so it's great to see how easy an implementation could be.
    The note about using mapping frameworks like AutoMapper brought me back to old debates on my team. We have a number of large and relatively complex objects in our services with a lot of attached metadata, and we used to use AutoMapper to handle the mapping so we didn't need to write these large mappers by hand. We eventually moved away from those to manual mappers for a couple of reasons: trying to debug errors in AutoMapper was way harder than it needed to be, so when something went wrong the reasons why were hidden away and not easily discernible from the stack trace, and also because they were several times more performant than AutoMapper. Would love to know your thoughts on that

  • @kunalkslvlogs2823
    @kunalkslvlogs2823 ปีที่แล้ว +3

    I love your content and regularly watching your videos

  • @mgame8082
    @mgame8082 2 หลายเดือนก่อน

    Waiting for new videos!!! This is high quality content.

  • @vineetkumarsingh3155
    @vineetkumarsingh3155 ปีที่แล้ว +6

    Great video Les, loved your content. I would have loved to see you using another c# application as client, rather than using postman. That would have completed the loop.

  • @user-wj8lx2ws8y
    @user-wj8lx2ws8y ปีที่แล้ว +1

    Awesome explanation... Thank you Les 👏👏👏

  • @khanfaizan05
    @khanfaizan05 19 วันที่ผ่านมา

    Great video. ❤
    Thankyou so much

  • @mohammadramezani1233
    @mohammadramezani1233 ปีที่แล้ว +6

    Welcom back les can we use grpc in angular in dotnet7?

  • @kevinison3740
    @kevinison3740 5 หลายเดือนก่อน

    Excellent video, thank you Les!

  • @HaoNguyen-km9xj
    @HaoNguyen-km9xj ปีที่แล้ว

    Nice, long time to see a new video.

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

    You are fantastic!!!! Thank you for your effort for us

  • @elan311X
    @elan311X 5 หลายเดือนก่อน

    Timeless 💯

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

    Thanks for this video. Can you explain how to use kafka in microservice like a pro?

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

    Spot on Les, another little nugget.

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

    thank u so much Sir, I think your channel the best for learn

  • @avanthasiriwardana
    @avanthasiriwardana 11 หลายเดือนก่อน

    If Les, no comments. Always good stuffs, Thanks Mate

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

    Epic!

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

    You are god sent

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

    Excellent content as always.

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

    Thanks for the lesson!

  • @gilpel77
    @gilpel77 8 หลายเดือนก่อน

    Amazing content as usual Les, thank you.
    I am wondering for which particular use you would go for gRPC communication rather than REST.
    In my case, i have a bunch of computational microservices that need to communicate frequently and intensively together (1k-1Mb) and other microservices, more high level, that do not generate such heavy traffic and which are the ones that really require a UI to interact with. Do you think it would be a good idea to go for gRPC for the intensive ones and REST for the UI orientes onea. Or just gRPC for everyone and the jsonTrancoding layer for the higher level servicesthat will need webapp client to be plugged in for user interaction?

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

    Another great video! thank you Les

  • @chuonchuon7386
    @chuonchuon7386 6 หลายเดือนก่อน

    Thank you

  • @gerahambe1
    @gerahambe1 6 หลายเดือนก่อน

    thank you so much

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

    very cool Les!
    thanks!

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

    Thanks for this great tutorial

  • @stevenpotter9555
    @stevenpotter9555 9 หลายเดือนก่อน

    Hi Les, this is the first of your videos that I've watched and I have to say that it is very well done. I was able to follow along and build a functioning gRPC service with JSON transcoding and a working OpenAPI\swagger definition. This is great and as a WCF developer I can see this being a viable migration path. My only problem is that I just can't seem to understand the self-hosting as windows service concept. I can do this with WCF configuring my endpoints, timeouts, logging etc. But I just don't see any thorough instructions on how to do this similarly with gRPC it's glossed over in the documentation and not even touched in any of my books. Any chance you could do a walk through on the various hosting methods, exclusively detailing the self-hosting model? Thanks...

  • @Ronaldos267
    @Ronaldos267 8 หลายเดือนก่อน

    Thank you Les for the fantastic tutorial and hard work for us as always. We can use gRPC service directly with Windows Forms/WPF applications and even with .NET MAUI app. I have a question - does JSON transcoding put some overhead while deserializing the JSON request to the Protobuf message or we gain the same performance benefit associated with using it without transcoding? Your help/guidance will really be very helpful

  • @The-Z-Zone
    @The-Z-Zone 11 หลายเดือนก่อน

    Great video. Any pointers on how authentication/authorization would work using GRPC in combination with the REST endpoints?

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

    Thanks for the content!

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

    extraordinary!!!

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

    Great video, thanks. I just have two questions:
    1) at minute 42 you do a null check with "!=" operator. Is it not better using "is" keyword ?
    2) why do you write time code in the video description? Is it more time consuming splitting the video in chapters?

  • @aliwa91
    @aliwa91 6 หลายเดือนก่อน

    Welcome back

  • @parthgupta6789
    @parthgupta6789 7 หลายเดือนก่อน

    How your terminal give suggestion for adding the packages?

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

    Love this video, Les

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

    Nice one Les. Please can you add a tutorial on how to consume the grpc in code ?

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

      In code you mean your frontend project? If yes, HTTP transcoding has made it easier since you can call a gRPC service like a REST endpoint.

  • @mostafaelnady4368
    @mostafaelnady4368 10 หลายเดือนก่อน

    amazing

  • @BartVandenAbbeel
    @BartVandenAbbeel 2 หลายเดือนก่อน

    Is it not better to return 204 No Content instead of 404 Not Found. 404 is when the operation is not found (error), and is not data related.

  • @shababarshad8688
    @shababarshad8688 7 หลายเดือนก่อน

    hi @jackson how we can set arguments in request which are class or custom objects kindly tell if there is any solution

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

    Let's say I've a BrokenRule type that I want to reuse in multiple gRPC projects/solutions. Can I include my BrokenRule proto file and generated code into a Nuget assembly and make it available to other services ? Will I be able to include the type into another proto file without regenerating the code ? Thanks for your help

  • @charlescasmir8098
    @charlescasmir8098 4 หลายเดือนก่อน

    Bro, can one connect an MVC to a gRPC server?

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

    bro dotnet core mvc application in aws ec2 instance how to depoy

  • @yigitbozkurt1965
    @yigitbozkurt1965 10 หลายเดือนก่อน

    we're waiting for the new videos...

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

    Thanks for the nice video, was just wondering why in every method of ToDoService, you are returning await Task.FromResult(object), looks like we can directly return the object

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

      Yes do that instead, indeed very bad what he has shown there.

  • @jafarnabhani635
    @jafarnabhani635 2 หลายเดือนก่อน

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

    Hello Les
    Thanks for the video very helpful I was looking for this solution for a while. After I created the proto-file and built the application I noticed I made a mistake in ListToDo procedure "ListToDo(GetAllRequests) returns (GetAllResponse)"
    I fixed the error ""ListToDo(GetAllResponse) returns (GetAllRequests)" but no matter what I tried the implementation of the service gave every time the override wat not matching, I tried everything obj and bin folder deleted but couldn't fix it except recreate the whole project.
    Do you perhaps have a tip to fix an error in the proto file so that it also matches with the relevant server.