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
Copy file name to clipboardExpand all lines: components/Extensions.DependencyInjection/CommunityToolkit.Extensions.DependencyInjection.SourceGenerators/ServiceProviderGenerator.Execute.cs
+14-13Lines changed: 14 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -199,9 +199,9 @@ public static CompilationUnitSyntax GetSyntax(ServiceCollectionInfo info)
199
199
// Prepare the method name, either AddSingleton or AddTransient
// Special case when the service is a singleton and no dependent services are present, just use eager instantiation instead:
202
+
// Special case when the service is a singleton and no dependent services are present, we can use the parameterless constructor
203
203
//
204
-
// global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(<PARAMETER_NAME>, typeof(<ROOT_SERVICE_TYPE>), new <IMPLEMENTATION_TYPE>());
204
+
// global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(<PARAMETER_NAME>, typeof(<ROOT_SERVICE_TYPE>), static _ => new <IMPLEMENTATION_TYPE>());
0 commit comments