Skip to content

Commit

Permalink
refactor: Fix false positive null reference
Browse files Browse the repository at this point in the history
  • Loading branch information
oboukli committed Apr 6, 2024
1 parent ca6ffc9 commit e92a6a2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Aktabook.Bus/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
TelemetryOptions telemetryOptions = context
.Configuration
.GetRequiredSection(nameof(TelemetryOptions))
.Get<TelemetryOptions>();
.Get<TelemetryOptions>()!;

services.AddSingleton(new ActivitySource(telemetryOptions.ServiceName));
services.AddOpenTelemetry()
Expand All @@ -100,7 +100,7 @@
OpenLibraryClientOptions openLibraryClientOptions = context
.Configuration
.GetRequiredSection(nameof(OpenLibraryClientOptions))
.Get<OpenLibraryClientOptions>();
.Get<OpenLibraryClientOptions>()!;
services.AddOpenLibraryClient(openLibraryClientOptions);
services.AddScoped<IBookInfoRequester, BookInfoRequester>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public static SqlConnectionStringBuilder GetSqlConnectionStringBuilderFrom(
{
return configuration
.GetRequiredSection(section)
.Get<SqlConnectionStringBuilder>(options => options.ErrorOnUnknownConfiguration = true);
.Get<SqlConnectionStringBuilder>(options => options.ErrorOnUnknownConfiguration = true)!;
}

public static string GetRabbitMqBusConnectionString(this IConfiguration configuration, string section)
{
return configuration
.GetRequiredSection(section)
.Get<AmqpUriBuilder>().ConnectionUri.ToString();
.Get<AmqpUriBuilder>()!.ConnectionUri.ToString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public RequesterServiceDbContext CreateDbContext()
_connectionString = new ConfigurationFactory()
.Configuration
.GetRequiredSection(DbContextConstants.RequesterServiceDbContextSqlServerSection)
.Get<SqlConnectionStringBuilder>(options => options.ErrorOnUnknownConfiguration = true)
.Get<SqlConnectionStringBuilder>(options => options.ErrorOnUnknownConfiguration = true)!
.ConnectionString;
}

Expand Down

0 comments on commit e92a6a2

Please sign in to comment.