Skip to content

Fix compiler errors. #1000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ private static ODataApiVersionCollectionProvider CollateApiVersions(

private sealed class ODataApiVersionCollectionProvider : IODataApiVersionCollectionProvider
{
required public IReadOnlyList<ApiVersion> ApiVersions { get; set; }
public required IReadOnlyList<ApiVersion> ApiVersions { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ private static void AddApiVersioningServices( IServiceCollection services )
}

services.TryAddSingleton<IApiVersionParser, ApiVersionParser>();
services.Add( Singleton( sp => sp.GetRequiredService<IOptions<ApiVersioningOptions>>().Value.ApiVersionReader ) );
services.Add( Singleton( sp => (IApiVersionParameterSource) sp.GetRequiredService<IOptions<ApiVersioningOptions>>().Value.ApiVersionReader ) );
services.Add( Singleton( sp => sp.GetRequiredService<IOptions<ApiVersioningOptions>>().Value.ApiVersionSelector ) );
services.AddSingleton( sp => sp.GetRequiredService<IOptions<ApiVersioningOptions>>().Value.ApiVersionReader );
services.AddSingleton( sp => (IApiVersionParameterSource) sp.GetRequiredService<IOptions<ApiVersioningOptions>>().Value.ApiVersionReader ) ;
services.AddSingleton( sp => sp.GetRequiredService<IOptions<ApiVersioningOptions>>().Value.ApiVersionSelector );
services.TryAddSingleton<IReportApiVersions, DefaultApiVersionReporter>();
services.TryAddSingleton<ISunsetPolicyManager, SunsetPolicyManager>();
services.TryAddEnumerable( Transient<IPostConfigureOptions<RouteOptions>, ApiVersioningRouteOptionsSetup>() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ namespace Asp.Versioning;
[CLSCompliant( false )]
public class ApiVersioningApplicationModelProvider : IApplicationModelProvider
{
private readonly IOptions<ApiVersioningOptions> options;
private readonly IOptions<MvcApiVersioningOptions> mvcOptions;
private readonly MvcApiVersioningOptions mvcOptions;

/// <summary>
/// Initializes a new instance of the <see cref="ApiVersioningApplicationModelProvider"/> class.
Expand All @@ -32,8 +31,8 @@ public ApiVersioningApplicationModelProvider(
{
ControllerFilter = controllerFilter;
NamingConvention = namingConvention;
this.options = options;
this.mvcOptions = mvcOptions;
Options = options?.Value ?? throw new ArgumentNullException( nameof( options ) );
this.mvcOptions = mvcOptions?.Value ?? throw new ArgumentNullException( nameof( mvcOptions ) );
}

/// <inheritdoc />
Expand All @@ -55,13 +54,13 @@ public ApiVersioningApplicationModelProvider(
/// Gets the builder used to define API version conventions.
/// </summary>
/// <value>An <see cref="IApiVersionConventionBuilder">API version convention builder</see>.</value>
protected IApiVersionConventionBuilder ConventionBuilder => mvcOptions.Value.Conventions;
protected IApiVersionConventionBuilder ConventionBuilder => mvcOptions.Conventions;

/// <summary>
/// Gets the API versioning options associated with the model provider.
/// </summary>
/// <value>The current <see cref="ApiVersioningOptions">API versioning options</see>.</value>
protected ApiVersioningOptions Options => options.Value;
protected ApiVersioningOptions Options { get; }

/// <inheritdoc />
public virtual void OnProvidersExecuted( ApplicationModelProviderContext context ) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public class ODataValue<T>
#if NETFRAMEWORK
public T Value { get; set; } = default!;
#else
required public T Value { get; set; }
public required T Value { get; set; }
#endif
}
2 changes: 1 addition & 1 deletion src/Common/src/Common.OData/OData/ODataId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public class ODataId
#if NETFRAMEWORK
public Uri Value { get; set; } = default!;
#else
required public Uri Value { get; set; }
public required Uri Value { get; set; }
#endif
}