From 966592bf21524af147edffdfd15f2ccc1c6372b6 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Fri, 7 Jul 2023 16:39:49 +0800 Subject: [PATCH] Enable nullable annotations for Volo.Abp.AspNetCore.Components.WebAssembly --- .../Components/MauiBlazor/MauiBlazorServerUrlProvider.cs | 2 +- .../Extensibility/BlazorServerLookupApiRequestService.cs | 2 +- .../Volo.Abp.AspNetCore.Components.WebAssembly.csproj | 2 ++ .../WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs | 2 +- .../Components/WebAssembly/WebAssemblyServerUrlProvider.cs | 2 +- .../Volo/Abp/Http/Client/RemoteServiceConfiguration.cs | 4 ++-- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorServerUrlProvider.cs b/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorServerUrlProvider.cs index a76d631677..a93472d3b8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorServerUrlProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorServerUrlProvider.cs @@ -23,6 +23,6 @@ public class MauiBlazorServerUrlProvider : IServerUrlProvider, ITransientDepende remoteServiceName ?? RemoteServiceConfigurationDictionary.DefaultName ); - return remoteServiceConfiguration.BaseUrl!.EnsureEndsWith('/'); + return remoteServiceConfiguration.BaseUrl.EnsureEndsWith('/'); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/Extensibility/BlazorServerLookupApiRequestService.cs b/framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/Extensibility/BlazorServerLookupApiRequestService.cs index 130d2f9225..00a5086031 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/Extensibility/BlazorServerLookupApiRequestService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/Extensibility/BlazorServerLookupApiRequestService.cs @@ -52,7 +52,7 @@ public class BlazorServerLookupApiRequestService : ILookupApiRequestService, ITr { //Blazor tiered -- mode var remoteServiceConfig = await RemoteServiceConfigurationProvider.GetConfigurationOrDefaultAsync("Default"); - baseUrl = remoteServiceConfig.BaseUrl!; + baseUrl = remoteServiceConfig.BaseUrl; client.BaseAddress = new Uri(baseUrl); AddHeaders(requestMessage); await HttpClientAuthenticator.Authenticate(new RemoteServiceHttpClientAuthenticateContext(client, diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj index 4618f31b6c..408844627e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo.Abp.AspNetCore.Components.WebAssembly.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable Volo.Abp.AspNetCore.Components.WebAssembly Volo.Abp.AspNetCore.Components.WebAssembly $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs index 2657e5bca7..b16286c19f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/AbpAspNetCoreComponentsWebAssemblyModule.cs @@ -67,7 +67,7 @@ public class AbpAspNetCoreComponentsWebAssemblyModule : AbpModule var cultureName = configuration.Localization?.CurrentCulture?.CultureName; if (!cultureName.IsNullOrEmpty()) { - var culture = new CultureInfo(cultureName); + var culture = new CultureInfo(cultureName!); CultureInfo.DefaultThreadCurrentCulture = culture; CultureInfo.DefaultThreadCurrentUICulture = culture; } diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyServerUrlProvider.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyServerUrlProvider.cs index 2fb133a10d..b74f5a1900 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyServerUrlProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebAssemblyServerUrlProvider.cs @@ -17,7 +17,7 @@ public class WebAssemblyServerUrlProvider : IServerUrlProvider, ITransientDepend RemoteServiceConfigurationProvider = remoteServiceConfigurationProvider; } - public async Task GetBaseUrlAsync(string remoteServiceName = null) + public async Task GetBaseUrlAsync(string? remoteServiceName = null) { var remoteServiceConfiguration = await RemoteServiceConfigurationProvider.GetConfigurationOrDefaultAsync( remoteServiceName ?? RemoteServiceConfigurationDictionary.DefaultName diff --git a/framework/src/Volo.Abp.RemoteServices/Volo/Abp/Http/Client/RemoteServiceConfiguration.cs b/framework/src/Volo.Abp.RemoteServices/Volo/Abp/Http/Client/RemoteServiceConfiguration.cs index 89d0b79f48..531b016a1d 100644 --- a/framework/src/Volo.Abp.RemoteServices/Volo/Abp/Http/Client/RemoteServiceConfiguration.cs +++ b/framework/src/Volo.Abp.RemoteServices/Volo/Abp/Http/Client/RemoteServiceConfiguration.cs @@ -7,8 +7,8 @@ public class RemoteServiceConfiguration : Dictionary /// /// Base Url. /// - public string? BaseUrl { - get => this.GetOrDefault(nameof(BaseUrl)); + public string BaseUrl { + get => this.GetOrDefault(nameof(BaseUrl))!; set => this[nameof(BaseUrl)] = value; }