Skip to content

Commit

Permalink
[repo-shared] Remove the new() constraint from Options API helpers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBlanch authored Mar 7, 2024
1 parent b90c3b2 commit f34fce5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Shared/Options/ConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public static bool TryGetValue<T>(
public static IServiceCollection RegisterOptionsFactory<T>(
this IServiceCollection services,
Func<IConfiguration, T> optionsFactoryFunc)
where T : class, new()
where T : class
{
Debug.Assert(services != null, "services was null");
Debug.Assert(optionsFactoryFunc != null, "optionsFactoryFunc was null");
Expand All @@ -150,7 +150,7 @@ public static IServiceCollection RegisterOptionsFactory<T>(
public static IServiceCollection RegisterOptionsFactory<T>(
this IServiceCollection services,
Func<IServiceProvider, IConfiguration, string, T> optionsFactoryFunc)
where T : class, new()
where T : class
{
Debug.Assert(services != null, "services was null");
Debug.Assert(optionsFactoryFunc != null, "optionsFactoryFunc was null");
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/Options/DelegatingOptionsFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Microsoft.Extensions.Options
/// <typeparam name="TOptions">The type of options being requested.</typeparam>
internal sealed class DelegatingOptionsFactory<TOptions> :
IOptionsFactory<TOptions>
where TOptions : class, new()
where TOptions : class
{
private readonly Func<IConfiguration, string, TOptions> optionsFactoryFunc;
private readonly IConfiguration configuration;
Expand Down

0 comments on commit f34fce5

Please sign in to comment.