Skip to content

Commit 42f131c

Browse files
author
Dries Verbeke
committed
Renaming InstantAPIsServiceOptions
To be more inline with other library setups we rename the ServiceOptions to plain Options. There is no specific need for ServiceOptions in a plugin.
1 parent bd3279d commit 42f131c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

InstantAPIs/InstantAPIsServiceOptions.cs renamed to InstantAPIs/InstantAPIsOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public enum EnableSwagger
99
Always
1010
}
1111

12-
public class InstantAPIsServiceOptions
12+
public class InstantAPIsOptions
1313
{
1414

1515
public EnableSwagger? EnableSwagger { get; set; }

InstantAPIs/InstantAPIsServiceCollectionExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ namespace InstantAPIs;
44

55
public static class InstantAPIsServiceCollectionExtensions
66
{
7-
public static IServiceCollection AddInstantAPIs(this IServiceCollection services, Action<InstantAPIsServiceOptions>? setupAction = null)
7+
public static IServiceCollection AddInstantAPIs(this IServiceCollection services, Action<InstantAPIsOptions>? setupAction = null)
88
{
9-
var options = new InstantAPIsServiceOptions();
9+
var options = new InstantAPIsOptions();
1010

1111
// Get the service options
1212
setupAction?.Invoke(options);
@@ -24,7 +24,7 @@ public static IServiceCollection AddInstantAPIs(this IServiceCollection services
2424
}
2525

2626
// Register the required options so that it can be accessed by InstantAPIs middleware
27-
services.Configure<InstantAPIsServiceOptions>(config =>
27+
services.Configure<InstantAPIsOptions>(config =>
2828
{
2929
config.EnableSwagger = options.EnableSwagger;
3030
});

InstantAPIs/WebApplicationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private static void MapInstantAPIsUsingReflection<D>(IEndpointRouteBuilder app,
7676
private static void AddOpenAPIConfiguration<D>(IEndpointRouteBuilder app, Action<InstantAPIsBuilder<D>>? options, IApplicationBuilder applicationBuilder) where D : DbContext
7777
{
7878
// Check if AddInstantAPIs was called by getting the service options and evaluate EnableSwagger property
79-
var serviceOptions = applicationBuilder.ApplicationServices.GetRequiredService<IOptions<InstantAPIsServiceOptions>>().Value;
79+
var serviceOptions = applicationBuilder.ApplicationServices.GetRequiredService<IOptions<InstantAPIsOptions>>().Value;
8080
if (serviceOptions == null || serviceOptions.EnableSwagger == null)
8181
{
8282
throw new ArgumentException("Call builder.Services.AddInstantAPIs(options) before MapInstantAPIs.");

0 commit comments

Comments
 (0)