Skip to content

Commit

Permalink
Register GraphQL types as transient to allow resolving them while bui…
Browse files Browse the repository at this point in the history
…lding the schema. (#16143)
  • Loading branch information
gvkries authored May 23, 2024
1 parent 7788401 commit 64f7040
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void AddInputObjectGraphType<TObject, TObjectType>(this IServiceCo
where TObject : class
where TObjectType : InputObjectGraphType<TObject>
{
services.AddScoped<TObjectType>();
services.AddTransient<TObjectType>();
services.AddTransient<InputObjectGraphType<TObject>, TObjectType>(s => s.GetRequiredService<TObjectType>());
services.AddTransient<IInputObjectGraphType, TObjectType>(s => s.GetRequiredService<TObjectType>());
}
Expand All @@ -30,7 +30,7 @@ public static void AddObjectGraphType<TInput, TInputType>(this IServiceCollectio
where TInput : class
where TInputType : ObjectGraphType<TInput>
{
services.AddScoped<TInputType>();
services.AddTransient<TInputType>();
services.AddTransient<ObjectGraphType<TInput>, TInputType>(s => s.GetRequiredService<TInputType>());
services.AddTransient<IObjectGraphType, TInputType>(s => s.GetRequiredService<TInputType>());
}
Expand Down

0 comments on commit 64f7040

Please sign in to comment.