dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
3.65k stars 416 forks source link

Code-first gRPC #1073

Closed flibbertigibbet-uk closed 6 months ago

flibbertigibbet-uk commented 9 months ago

I am considering migrating a C# Core solution to Aspire and this solution currently uses a library that implements code-first gRPC https://protobuf-net.github.io/protobuf-net.Grpc/gettingstarted and https://github.com/protobuf-net/protobuf-net.Grpc

Has anyone been down this route?

I notice @JamesNK (co-author of protobuf-net.Grpc) has been active in this repository and previously discussed support of named gRPC end-points. https://github.com/dotnet/aspire/issues/186 Is this delayed feature relevant to migrating protobuf-net.Grpc based application code to Aspire?

And before hitting the submit button I did some extra searching and found this open issue https://github.com/dotnet/aspire/issues/898 which references the eShop sample. The sample code includes application level extension methods to support gRPC service discovery. I think I can just lift the gRPC extension method from the eShop code and replace:

services.AddGrpcClient<TClient>

with

services.AddCodeFirstGrpcClient<TClient>

davidfowl commented 9 months ago

This feature is a pure convenience over what is there today but AFAIK code first grpc should just work with service discovery. Is that what you are asking?