Book Image

Apps and Services with .NET 7

By : Mark J. Price
Book Image

Apps and Services with .NET 7

By: Mark J. Price

Overview of this book

Apps and Services with .NET 7 is for .NET 6 and .NET 7 developers who want to kick their C# and .NET understanding up a gear by learning the practical skills and knowledge they need to build real-world applications and services. It covers specialized libraries that will help you monitor and improve performance, secure your data and applications, and internationalize your code and apps. With chapters that put a variety of technologies into practice, including Web API, OData, gRPC, GraphQL, SignalR, and Azure Functions, this book will give you a broader scope of knowledge than other books that often focus on only a handful of .NET technologies. It covers the latest developments, libraries, and technologies that will help keep you up to date. You’ll also leverage .NET MAUI to develop mobile apps for iOS and Android as well as desktop apps for Windows and macOS.
Table of Contents (23 chapters)
22
Index

Implementing gRPC JSON transcoding

JSON is the most popular format for services that return data to a browser or mobile device. It would be great if we could create a gRPC service and magically make it callable via non-HTTP/2 using JSON. Thankfully, there is a solution.

Microsoft has a new technology they have named gRPC JSON transcoding, which is an ASP.NET Core extension that creates HTTP endpoints with JSON for gRPC services, based on Google’s HttpRule class for their gRPC Transcoding. You can read about that at the following link: https://cloud.google.com/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.HttpRule.

Enabling gRPC JSON transcoding

Let’s see how to enable gRPC JSON transcoding in our gRPC service:

  1. In the Northwind.Grpc.Service project, add a package reference for gRPC JSON transcoding, as shown highlighted in the following markup:
    <ItemGroup>
      <PackageReference Include="Grpc.AspNetCore&quot...