You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following `WeatherForecastController` logs the <xref:Microsoft.AspNetCore.Identity.IdentityUser%601.UserName> when the `Get` method is called.
31
31
32
32
> [!NOTE]
33
-
> The following example uses a [file-scoped namespace](/dotnet/csharp/language-reference/keywords/namespace), which is a C# 10 or later (.NET 6 or later) feature.
33
+
> The following example uses:
34
+
>
35
+
> * A [file-scoped namespace](/dotnet/csharp/language-reference/keywords/namespace), which is a C# 10 or later (.NET 6 or later) feature.
36
+
> * A [primary constructor](/dotnet/csharp/whats-new/tutorials/primary-constructors), which is a C# 12 or later (.NET 8 or later) feature.
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/aot/request-delegate-generator/rdg.md
+22-3Lines changed: 22 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,4 @@
1
1
---
2
-
3
2
title: ASP.NET Core Request Delegate Generator (RDG) for Native AOT
4
3
description: Turn Map methods into request delegates with the ASP.NET Core Request Delegate Generator (RDG) for Native AOT.
5
4
author: rick-anderson
@@ -48,7 +47,17 @@ The RDG:
48
47
* Is enabled automatically in projects when publishing with Native AOT is enabled or when trimming is enabled.
49
48
* Can be manually enabled even when not using Native AOT by setting `<EnableRequestDelegateGenerator>true</EnableRequestDelegateGenerator>` in the project file:
@@ -57,7 +66,17 @@ Manually enabling RDG can be useful for:
57
66
58
67
Minimal APIs are optimized for using <xref:System.Text.Json>, which requires using the [System.Text.Json source generator](/dotnet/standard/serialization/system-text-json/source-generation). All types accepted as parameters to or returned from request delegates in Minimal APIs must be configured on a <xref:System.Text.Json.Serialization.JsonSerializerContext> that's registered via ASP.NET Core's dependency injection:
Copy file name to clipboardExpand all lines: aspnetcore/grpc/aspnetcore.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,17 +153,31 @@ For more information about using the `Microsoft.AspNetCore.App` framework refere
153
153
154
154
## Integration with ASP.NET Core APIs
155
155
156
-
gRPC services have full access to the ASP.NET Core features such as [Dependency Injection](xref:fundamentals/dependency-injection) (DI) and [Logging](xref:fundamentals/logging/index). For example, the service implementation can resolve a logger service from the DI container via the constructor:
156
+
gRPC services have full access to the ASP.NET Core features such as [dependency injection](xref:fundamentals/dependency-injection) (DI) and [logging](xref:fundamentals/logging/index). For example, the service implementation can resolve a logger service from the DI container.
@@ -87,6 +112,7 @@ public class GreeterService : Greeter.GreeterBase
87
112
ServerCallContextcontext)
88
113
{
89
114
_logger.LogInformation("Saying hello to {Name}", request.Name);
115
+
90
116
returnTask.FromResult(newHelloReply
91
117
{
92
118
Message="Hello "+request.Name
@@ -95,6 +121,10 @@ public class GreeterService : Greeter.GreeterBase
95
121
}
96
122
```
97
123
124
+
:::moniker-end
125
+
126
+
:::moniker range=">= aspnetcore-6.0"
127
+
98
128
`GreeterService` inherits from the `GreeterBase` type, which is generated from the `Greeter` service in the `.proto` file. The service is made accessible to clients in `Program.cs`:
99
129
100
130
```csharp
@@ -132,6 +162,7 @@ For more information on creating clients, and calling different service methods,
Copy file name to clipboardExpand all lines: aspnetcore/grpc/migration.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,17 +86,31 @@ For more information on configuration, see <xref:grpc/configuration>.
86
86
87
87
## Logging
88
88
89
-
C-core-based apps rely on the `GrpcEnvironment` to [configure the logger](https://grpc.io/grpc/csharp/api/Grpc.Core.GrpcEnvironment.html?q=size#Grpc_Core_GrpcEnvironment_SetLogger_Grpc_Core_Logging_ILogger_) for debugging purposes. The ASP.NET Core stack provides this functionality through the [Logging API](xref:fundamentals/logging/index). For example, a logger can be added to the gRPC service via constructor injection:
89
+
C-core-based apps rely on the `GrpcEnvironment` to [configure the logger](https://grpc.io/grpc/csharp/api/Grpc.Core.GrpcEnvironment.html?q=size#Grpc_Core_GrpcEnvironment_SetLogger_Grpc_Core_Logging_ILogger_) for debugging purposes. The ASP.NET Core stack provides this functionality through the [Logging API](xref:fundamentals/logging/index). For example, a logger can be added to the gRPC service.
0 commit comments