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-ids.md
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,12 +12,8 @@ ai-usage: ai-assisted
12
12
---
13
13
# ASP.NET Core Request Delegate Generator (RDG) diagnostics
14
14
15
-
<!-- UPDATE 9.0 Activate after release and INCLUDE is updated
16
-
17
15
[!INCLUDE[](~/includes/not-latest-version.md)]
18
16
19
-
-->
20
-
21
17
The ASP.NET Core Request Delegate Generator (RDG) is a tool that generates request delegates for ASP.NET Core apps. The RDG is used by the native ahead-of-time (AOT) compiler to generate request delegates for the app's `Map` methods.
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/aot/request-delegate-generator/rdg.md
+22-7Lines changed: 22 additions & 7 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
@@ -13,12 +12,8 @@ ai-usage: ai-assisted
13
12
---
14
13
# Turn Map methods into request delegates with the ASP.NET Core Request Delegate Generator
15
14
16
-
<!-- UPDATE 9.0 Activate after release and INCLUDE is updated
17
-
18
15
[!INCLUDE[](~/includes/not-latest-version.md)]
19
16
20
-
-->
21
-
22
17
The ASP.NET Core Request Delegate Generator (RDG) is a compile-time source generator that compiles route handlers provided to a minimal API to request delegates that can be processed by ASP.NET Core's routing infrastructure. The RDG is implicitly enabled when applications are published with AoT enabled or when [trimming is enabled](/dotnet/core/deploying/trimming/trimming-options#enable-trimming). The RDG generates trim and native AoT-friendly code.
23
18
24
19
> [!NOTE]
@@ -48,7 +43,17 @@ The RDG:
48
43
* Is enabled automatically in projects when publishing with Native AOT is enabled or when trimming is enabled.
49
44
* Can be manually enabled even when not using Native AOT by setting `<EnableRequestDelegateGenerator>true</EnableRequestDelegateGenerator>` in the project file:
@@ -57,7 +62,17 @@ Manually enabling RDG can be useful for:
57
62
58
63
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,
0 commit comments