diff --git a/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorRemoteTenantStore.cs b/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorRemoteTenantStore.cs index 235fe74354..d17a2b6f87 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorRemoteTenantStore.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorRemoteTenantStore.cs @@ -98,7 +98,7 @@ public class MauiBlazorRemoteTenantStore : ITenantStore, ITransientDependency return null; } - return new TenantConfiguration(tenantResultDto.TenantId.Value, tenantResultDto.Name); + return new TenantConfiguration(tenantResultDto.TenantId.Value, tenantResultDto.Name!); } protected virtual string CreateCacheKey(string tenantName) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo.Abp.AspNetCore.Mvc.Client.Common.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo.Abp.AspNetCore.Mvc.Client.Common.csproj index 9f9ddb9755..49c0eca552 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo.Abp.AspNetCore.Mvc.Client.Common.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo.Abp.AspNetCore.Mvc.Client.Common.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.AspNetCore.Mvc.Client.Common Volo.Abp.AspNetCore.Mvc.Client.Common $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteExternalLocalizationStore.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteExternalLocalizationStore.cs index c5548acc62..4de2f28391 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteExternalLocalizationStore.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteExternalLocalizationStore.cs @@ -22,13 +22,13 @@ public class RemoteExternalLocalizationStore : IExternalLocalizationStore, ITran LocalizationOptions = localizationOptions.Value; } - public virtual LocalizationResourceBase GetResourceOrNull(string resourceName) + public virtual LocalizationResourceBase? GetResourceOrNull(string resourceName) { var configurationDto = ConfigurationClient.Get(); return CreateLocalizationResourceFromConfigurationOrNull(resourceName, configurationDto); } - public virtual async Task GetResourceOrNullAsync(string resourceName) + public virtual async Task GetResourceOrNullAsync(string resourceName) { var configurationDto = await ConfigurationClient.GetAsync(); return CreateLocalizationResourceFromConfigurationOrNull(resourceName, configurationDto); @@ -63,7 +63,7 @@ public class RemoteExternalLocalizationStore : IExternalLocalizationStore, ITran return resources.ToArray(); } - protected virtual LocalizationResourceBase CreateLocalizationResourceFromConfigurationOrNull( + protected virtual LocalizationResourceBase? CreateLocalizationResourceFromConfigurationOrNull( string resourceName, ApplicationConfigurationDto configurationDto) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs index d3969e7888..f356324445 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs @@ -13,7 +13,7 @@ public class RemoteFeatureChecker : FeatureCheckerBase ConfigurationClient = configurationClient; } - public override async Task GetOrNullAsync(string name) + public override async Task GetOrNullAsync(string name) { var configuration = await ConfigurationClient.GetAsync(); return configuration.Features.Values.GetOrDefault(name); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs index e6e180c5f2..c361186a75 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs @@ -14,9 +14,9 @@ public class RemoteLocalizationContributor : ILocalizationResourceContributor { public bool IsDynamic => true; - private LocalizationResourceBase _resource; - private ICachedApplicationConfigurationClient _applicationConfigurationClient; - private ILogger _logger; + private LocalizationResourceBase _resource = default!; + private ICachedApplicationConfigurationClient _applicationConfigurationClient = default!; + private ILogger _logger = default!; public void Initialize(LocalizationResourceInitializationContext context) { @@ -26,7 +26,7 @@ public class RemoteLocalizationContributor : ILocalizationResourceContributor ?? NullLogger.Instance; } - public virtual LocalizedString GetOrNull(string cultureName, string name) + public virtual LocalizedString? GetOrNull(string cultureName, string name) { /* cultureName is not used because remote localization can only * be done in the current culture. */ @@ -34,7 +34,7 @@ public class RemoteLocalizationContributor : ILocalizationResourceContributor return GetOrNullInternal(_resource.ResourceName, name); } - protected virtual LocalizedString GetOrNullInternal(string resourceName, string name) + protected virtual LocalizedString? GetOrNullInternal(string resourceName, string name) { var resource = GetResourceOrNull(resourceName); if (resource == null) @@ -50,7 +50,7 @@ public class RemoteLocalizationContributor : ILocalizationResourceContributor foreach (var baseResource in resource.BaseResources) { - value = GetOrNullInternal(baseResource, name); + value = GetOrNullInternal(baseResource, name)?.ToString(); if (value != null) { return new LocalizedString(name, value); @@ -121,19 +121,19 @@ public class RemoteLocalizationContributor : ILocalizationResourceContributor return Task.FromResult((IEnumerable)Array.Empty()); } - protected virtual ApplicationLocalizationResourceDto GetResourceOrNull(string resourceName) + protected virtual ApplicationLocalizationResourceDto? GetResourceOrNull(string resourceName) { var applicationConfigurationDto = _applicationConfigurationClient.Get(); return GetResourceOrNull(applicationConfigurationDto, resourceName); } - protected virtual async Task GetResourceOrNullAsync(string resourceName) + protected virtual async Task GetResourceOrNullAsync(string resourceName) { var applicationConfigurationDto = await _applicationConfigurationClient.GetAsync(); return GetResourceOrNull(applicationConfigurationDto, resourceName); } - protected virtual ApplicationLocalizationResourceDto GetResourceOrNull( + protected virtual ApplicationLocalizationResourceDto? GetResourceOrNull( ApplicationConfigurationDto applicationConfigurationDto, string resourceName) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs index 2599df1ef6..6553ee9881 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs @@ -15,7 +15,7 @@ public class RemoteSettingProvider : ISettingProvider, ITransientDependency ConfigurationClient = configurationClient; } - public async Task GetOrNullAsync(string name) + public async Task GetOrNullAsync(string name) { var configuration = await ConfigurationClient.GetAsync(); return configuration.Setting.Values.GetOrDefault(name); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj index 2e5a66d740..39f753a6c0 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable Volo.Abp.AspNetCore.Mvc.Client Volo.Abp.AspNetCore.Mvc.Client $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs index 6f2cc1a05f..b7d8a0df40 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs @@ -47,14 +47,14 @@ public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigu return configuration; } - configuration = await Cache.GetOrAddAsync( + configuration = (await Cache.GetOrAddAsync( cacheKey, async () => await GetRemoteConfigurationAsync(), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = Options.ApplicationConfigurationDtoCacheAbsoluteExpiration } - ); + ))!; if (httpContext != null) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcRemoteTenantStore.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcRemoteTenantStore.cs index 3f091f8db8..aa9fc4beb8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcRemoteTenantStore.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcRemoteTenantStore.cs @@ -31,7 +31,7 @@ public class MvcRemoteTenantStore : ITenantStore, ITransientDependency Options = options.Value; } - public async Task FindAsync(string name) + public async Task FindAsync(string name) { var cacheKey = CreateCacheKey(name); var httpContext = HttpContextAccessor?.HttpContext; @@ -41,14 +41,14 @@ public class MvcRemoteTenantStore : ITenantStore, ITransientDependency return tenantConfiguration; } - tenantConfiguration = await Cache.GetOrAddAsync( + tenantConfiguration = (await Cache.GetOrAddAsync( cacheKey, - async () => CreateTenantConfiguration(await TenantAppService.FindTenantByNameAsync(name)), + async () => CreateTenantConfiguration(await TenantAppService.FindTenantByNameAsync(name))!, () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = Options.TenantConfigurationCacheAbsoluteExpiration } - ); + ))!; if (httpContext != null) { @@ -58,7 +58,7 @@ public class MvcRemoteTenantStore : ITenantStore, ITransientDependency return tenantConfiguration; } - public async Task FindAsync(Guid id) + public async Task FindAsync(Guid id) { var cacheKey = CreateCacheKey(id); var httpContext = HttpContextAccessor?.HttpContext; @@ -68,14 +68,14 @@ public class MvcRemoteTenantStore : ITenantStore, ITransientDependency return tenantConfiguration; } - tenantConfiguration = await Cache.GetOrAddAsync( + tenantConfiguration = (await Cache.GetOrAddAsync( cacheKey, - async () => CreateTenantConfiguration(await TenantAppService.FindTenantByIdAsync(id)), + async () => CreateTenantConfiguration(await TenantAppService.FindTenantByIdAsync(id))!, () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = Options.TenantConfigurationCacheAbsoluteExpiration } - ); + ))!; if (httpContext != null) { @@ -97,12 +97,12 @@ public class MvcRemoteTenantStore : ITenantStore, ITransientDependency tenantConfiguration = Cache.GetOrAdd( cacheKey, - () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await TenantAppService.FindTenantByNameAsync(name))), + () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await TenantAppService.FindTenantByNameAsync(name))!), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = Options.TenantConfigurationCacheAbsoluteExpiration } - ); + )!; if (httpContext != null) { @@ -124,12 +124,12 @@ public class MvcRemoteTenantStore : ITenantStore, ITransientDependency tenantConfiguration = Cache.GetOrAdd( cacheKey, - () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await TenantAppService.FindTenantByIdAsync(id))), + () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await TenantAppService.FindTenantByIdAsync(id))!), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = Options.TenantConfigurationCacheAbsoluteExpiration } - ); + )!; if (httpContext != null) { @@ -139,14 +139,14 @@ public class MvcRemoteTenantStore : ITenantStore, ITransientDependency return tenantConfiguration; } - protected virtual TenantConfiguration CreateTenantConfiguration(FindTenantResultDto tenantResultDto) + protected virtual TenantConfiguration? CreateTenantConfiguration(FindTenantResultDto tenantResultDto) { if (!tenantResultDto.Success || tenantResultDto.TenantId == null) { return null; } - return new TenantConfiguration(tenantResultDto.TenantId.Value, tenantResultDto.Name); + return new TenantConfiguration(tenantResultDto.TenantId.Value, tenantResultDto.Name!); } protected virtual string CreateCacheKey(string tenantName) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj index a89f7c60a7..e0ddc7cdbe 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.AspNetCore.Mvc.Contracts Volo.Abp.AspNetCore.Mvc.Contracts $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationDto.cs index 61b5ec18db..e9c079cc84 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationDto.cs @@ -31,4 +31,20 @@ public class ApplicationConfigurationDto : IHasExtraProperties public ObjectExtensionsDto ObjectExtensions { get; set; } public ExtraPropertyDictionary ExtraProperties { get; set; } + + public ApplicationConfigurationDto() + { + Localization = new ApplicationLocalizationConfigurationDto(); + Auth = new ApplicationAuthConfigurationDto(); + Setting = new ApplicationSettingConfigurationDto(); + CurrentUser = new CurrentUserDto(); + Features = new ApplicationFeatureConfigurationDto(); + GlobalFeatures = new ApplicationGlobalFeatureConfigurationDto(); + MultiTenancy = new MultiTenancyInfoDto(); + CurrentTenant = new CurrentTenantDto(); + Timing = new TimingDto(); + Clock = new ClockDto(); + ObjectExtensions = new ObjectExtensionsDto(); + ExtraProperties = new ExtraPropertyDictionary(); + } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationConfigurationDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationConfigurationDto.cs index b1c0c16e76..5ae2a8ed2d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationConfigurationDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationConfigurationDto.cs @@ -28,7 +28,7 @@ public class ApplicationLocalizationConfigurationDto public CurrentCultureDto CurrentCulture { get; set; } - public string DefaultResourceName { get; set; } + public string? DefaultResourceName { get; set; } public Dictionary> LanguagesMap { get; set; } @@ -38,5 +38,8 @@ public class ApplicationLocalizationConfigurationDto { Values = new Dictionary>(); Languages = new List(); + CurrentCulture = new CurrentCultureDto(); + LanguagesMap = new Dictionary>(); + LanguageFilesMap = new Dictionary>(); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationDto.cs index d301490bed..2bbc604c95 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationDto.cs @@ -7,4 +7,9 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; public class ApplicationLocalizationDto { public Dictionary Resources { get; set; } + + public ApplicationLocalizationDto() + { + Resources = new Dictionary(); + } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationRequestDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationRequestDto.cs index 535d572b3f..3b6debe695 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationRequestDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationRequestDto.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; public class ApplicationLocalizationRequestDto { [Required] - public string CultureName { get; set; } + public string CultureName { get; set; } = default!; public bool OnlyDynamics { get; set; } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationResourceDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationResourceDto.cs index a7200423d2..bca4ccd8ee 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationResourceDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationLocalizationResourceDto.cs @@ -7,6 +7,11 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; public class ApplicationLocalizationResourceDto { public Dictionary Texts { get; set; } - - public string[] BaseResources { get; set; } + + public string[] BaseResources { get; set; } = default!; + + public ApplicationLocalizationResourceDto() + { + Texts = new Dictionary(); + } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationSettingConfigurationDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationSettingConfigurationDto.cs index a1fbba2bbf..1ae30828cf 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationSettingConfigurationDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationSettingConfigurationDto.cs @@ -6,5 +6,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; [Serializable] public class ApplicationSettingConfigurationDto { - public Dictionary Values { get; set; } + public Dictionary Values { get; set; } + + public ApplicationSettingConfigurationDto() + { + Values = new Dictionary(); + } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ClockDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ClockDto.cs index 5112ac80ed..96cd5bd38b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ClockDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ClockDto.cs @@ -2,5 +2,5 @@ public class ClockDto { - public string Kind { get; set; } + public string Kind { get; set; } = default!; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentCultureDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentCultureDto.cs index 83f1e0c803..054e626844 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentCultureDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentCultureDto.cs @@ -5,21 +5,21 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; [Serializable] public class CurrentCultureDto { - public string DisplayName { get; set; } + public string DisplayName { get; set; } = default!; - public string EnglishName { get; set; } + public string EnglishName { get; set; } = default!; - public string ThreeLetterIsoLanguageName { get; set; } + public string ThreeLetterIsoLanguageName { get; set; } = default!; - public string TwoLetterIsoLanguageName { get; set; } + public string TwoLetterIsoLanguageName { get; set; } = default!; public bool IsRightToLeft { get; set; } - public string CultureName { get; set; } + public string CultureName { get; set; } = default!; - public string Name { get; set; } + public string Name { get; set; } = default!; - public string NativeName { get; set; } + public string NativeName { get; set; } = default!; - public DateTimeFormatDto DateTimeFormat { get; set; } + public DateTimeFormatDto DateTimeFormat { get; set; } = default!; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentUserDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentUserDto.cs index 08a8c4c873..63a4b7a0e9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentUserDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/CurrentUserDto.cs @@ -15,23 +15,23 @@ public class CurrentUserDto public Guid? ImpersonatorTenantId { get; set; } - public string ImpersonatorUserName { get; set; } + public string? ImpersonatorUserName { get; set; } - public string ImpersonatorTenantName { get; set; } + public string? ImpersonatorTenantName { get; set; } - public string UserName { get; set; } + public string? UserName { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public string SurName { get; set; } + public string? SurName { get; set; } - public string Email { get; set; } + public string? Email { get; set; } public bool EmailVerified { get; set; } - public string PhoneNumber { get; set; } + public string? PhoneNumber { get; set; } public bool PhoneNumberVerified { get; set; } - public string[] Roles { get; set; } + public string[] Roles { get; set; } = default!; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/DateTimeFormatDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/DateTimeFormatDto.cs index 5f5ad14a5a..a16282efdd 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/DateTimeFormatDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/DateTimeFormatDto.cs @@ -2,17 +2,17 @@ public class DateTimeFormatDto { - public string CalendarAlgorithmType { get; set; } + public string CalendarAlgorithmType { get; set; } = default!; - public string DateTimeFormatLong { get; set; } + public string DateTimeFormatLong { get; set; } = default!; - public string ShortDatePattern { get; set; } + public string ShortDatePattern { get; set; } = default!; - public string FullDateTimePattern { get; set; } + public string FullDateTimePattern { get; set; } = default!; - public string DateSeparator { get; set; } + public string DateSeparator { get; set; } = default!; - public string ShortTimePattern { get; set; } + public string ShortTimePattern { get; set; } = default!; - public string LongTimePattern { get; set; } + public string LongTimePattern { get; set; } = default!; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/EntityExtensionDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/EntityExtensionDto.cs index 742da779f6..533349527c 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/EntityExtensionDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/EntityExtensionDto.cs @@ -9,4 +9,10 @@ public class EntityExtensionDto public Dictionary Properties { get; set; } public Dictionary Configuration { get; set; } + + public EntityExtensionDto() + { + Properties = new Dictionary(); + Configuration = new Dictionary(); + } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionEnumDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionEnumDto.cs index 24e9ec9a2f..cd1d210005 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionEnumDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionEnumDto.cs @@ -8,5 +8,10 @@ public class ExtensionEnumDto { public List Fields { get; set; } - public string LocalizationResource { get; set; } + public string? LocalizationResource { get; set; } + + public ExtensionEnumDto() + { + Fields = new List(); + } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionEnumFieldDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionEnumFieldDto.cs index 13728d8409..03c0213015 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionEnumFieldDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionEnumFieldDto.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending; [Serializable] public class ExtensionEnumFieldDto { - public string Name { get; set; } + public string? Name { get; set; } - public object Value { get; set; } + public object? Value { get; set; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyAttributeDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyAttributeDto.cs index 492756168d..ea28fb3cb9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyAttributeDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyAttributeDto.cs @@ -6,7 +6,12 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending; [Serializable] public class ExtensionPropertyAttributeDto { - public string TypeSimple { get; set; } + public string TypeSimple { get; set; } = default!; public Dictionary Config { get; set; } + + public ExtensionPropertyAttributeDto() + { + Config = new Dictionary(); + } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyDto.cs index a1fb628e1a..68a915309d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyDto.cs @@ -7,12 +7,11 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending; [Serializable] public class ExtensionPropertyDto { - public string Type { get; set; } + public string Type { get; set; } = default!; - public string TypeSimple { get; set; } + public string TypeSimple { get; set; } = default!; - [CanBeNull] - public LocalizableStringDto DisplayName { get; set; } + public LocalizableStringDto? DisplayName { get; set; } public ExtensionPropertyApiDto Api { get; set; } @@ -22,5 +21,13 @@ public class ExtensionPropertyDto public Dictionary Configuration { get; set; } - public object DefaultValue { get; set; } + public object? DefaultValue { get; set; } + + public ExtensionPropertyDto() + { + Api = new ExtensionPropertyApiDto(); + Ui = new ExtensionPropertyUiDto(); + Attributes = new List(); + Configuration = new Dictionary(); + } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyUiDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyUiDto.cs index cd43df5446..2c90299b15 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyUiDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyUiDto.cs @@ -9,4 +9,12 @@ public class ExtensionPropertyUiDto public ExtensionPropertyUiFormDto OnCreateForm { get; set; } public ExtensionPropertyUiFormDto OnEditForm { get; set; } public ExtensionPropertyUiLookupDto Lookup { get; set; } + + public ExtensionPropertyUiDto() + { + OnTable = new ExtensionPropertyUiTableDto(); + OnCreateForm = new ExtensionPropertyUiFormDto(); + OnEditForm = new ExtensionPropertyUiFormDto(); + Lookup = new ExtensionPropertyUiLookupDto(); + } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyUiLookupDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyUiLookupDto.cs index b9bc94399c..ae5fd451de 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyUiLookupDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyUiLookupDto.cs @@ -5,9 +5,9 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending; [Serializable] public class ExtensionPropertyUiLookupDto { - public string Url { get; set; } - public string ResultListPropertyName { get; set; } - public string DisplayPropertyName { get; set; } - public string ValuePropertyName { get; set; } - public string FilterParamName { get; set; } + public string Url { get; set; } = default!; + public string ResultListPropertyName { get; set; } = default!; + public string DisplayPropertyName { get; set; } = default!; + public string ValuePropertyName { get; set; } = default!; + public string FilterParamName { get; set; } = default!; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/LocalizableStringDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/LocalizableStringDto.cs index 8127a90bd7..2fc1989ad5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/LocalizableStringDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/LocalizableStringDto.cs @@ -9,10 +9,9 @@ public class LocalizableStringDto [NotNull] public string Name { get; private set; } - [CanBeNull] - public string Resource { get; set; } + public string? Resource { get; set; } - public LocalizableStringDto([NotNull] string name, string resource = null) + public LocalizableStringDto([NotNull] string name, string? resource = null) { Name = Check.NotNullOrEmpty(name, nameof(name)); Resource = resource; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ModuleExtensionDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ModuleExtensionDto.cs index aadd08cd28..50c944f6ec 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ModuleExtensionDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ModuleExtensionDto.cs @@ -9,4 +9,10 @@ public class ModuleExtensionDto public Dictionary Entities { get; set; } public Dictionary Configuration { get; set; } + + public ModuleExtensionDto() + { + Entities = new Dictionary(); + Configuration = new Dictionary(); + } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ObjectExtensionsDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ObjectExtensionsDto.cs index f63935847b..b07855057b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ObjectExtensionsDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ObjectExtensionsDto.cs @@ -9,4 +9,10 @@ public class ObjectExtensionsDto public Dictionary Modules { get; set; } public Dictionary Enums { get; set; } + + public ObjectExtensionsDto() + { + Modules = new Dictionary(); + Enums = new Dictionary(); + } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/TimingDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/TimingDto.cs index ca03407ee5..7aa38ede79 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/TimingDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/TimingDto.cs @@ -3,6 +3,11 @@ public class TimingDto { public TimeZone TimeZone { get; set; } + + public TimingDto() + { + TimeZone = new TimeZone(); + } } public class TimeZone @@ -10,14 +15,20 @@ public class TimeZone public IanaTimeZone Iana { get; set; } public WindowsTimeZone Windows { get; set; } + + public TimeZone() + { + Iana = new IanaTimeZone(); + Windows = new WindowsTimeZone(); + } } public class WindowsTimeZone { - public string TimeZoneId { get; set; } + public string? TimeZoneId { get; set; } } public class IanaTimeZone { - public string TimeZoneName { get; set; } + public string? TimeZoneName { get; set; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/CurrentTenantDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/CurrentTenantDto.cs index b8b361e7c8..d8c1351b3e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/CurrentTenantDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/CurrentTenantDto.cs @@ -8,7 +8,7 @@ public class CurrentTenantDto { public Guid? Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } public bool IsAvailable { get; set; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/FindTenantResultDto.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/FindTenantResultDto.cs index 64bcc77554..599b0b8a67 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/FindTenantResultDto.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/FindTenantResultDto.cs @@ -9,7 +9,7 @@ public class FindTenantResultDto public Guid? TenantId { get; set; } - public string Name { get; set; } + public string? Name { get; set; } public bool IsActive { get; set; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson.csproj index 026fb2f4d4..bd0d7c063f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson/Volo.Abp.AspNetCore.Mvc.NewtonsoftJson.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable true Volo.Abp.AspNetCore.Mvc.NewtonsoftJson Volo.Abp.AspNetCore.Mvc.NewtonsoftJson diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Microsoft/AspNetCore/Razor/TagHelpers/AbpTagHelperAttributeListExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Microsoft/AspNetCore/Razor/TagHelpers/AbpTagHelperAttributeListExtensions.cs index 81aefb7382..def91ef68b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Microsoft/AspNetCore/Razor/TagHelpers/AbpTagHelperAttributeListExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Microsoft/AspNetCore/Razor/TagHelpers/AbpTagHelperAttributeListExtensions.cs @@ -22,7 +22,7 @@ public static class AbpTagHelperAttributeListExtensions } else { - var existingClasses = classAttribute.Value.ToString().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); + var existingClasses = classAttribute.Value.ToString()!.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); existingClasses.AddIfNotContains(className); attributes.SetAttribute("class", string.Join(" ", existingClasses)); } @@ -41,7 +41,7 @@ public static class AbpTagHelperAttributeListExtensions return; } - var classList = classAttribute.Value.ToString().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); + var classList = classAttribute.Value.ToString()!.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); classList.RemoveAll(c => c == className); attributes.SetAttribute("class", classList.JoinAsString(" ")); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelper.cs index 5b9c1430f2..8d0227fd11 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelper.cs @@ -23,7 +23,7 @@ public abstract class AbpTagHelper : AbpTagHelper [HtmlAttributeNotBound] [ViewContext] - public ViewContext ViewContext { get; set; } + public ViewContext ViewContext { get; set; } = default!; protected AbpTagHelper(TService service) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperLocalizer.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperLocalizer.cs index c4314134be..5b6db4ff17 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperLocalizer.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperLocalizer.cs @@ -27,12 +27,12 @@ public class AbpTagHelperLocalizer : IAbpTagHelperLocalizer : localizer[text].Value; } - public IStringLocalizer GetLocalizerOrNull(ModelExplorer explorer) + public IStringLocalizer? GetLocalizerOrNull(ModelExplorer explorer) { return GetLocalizerOrNull(explorer.Container.ModelType.Assembly); } - public IStringLocalizer GetLocalizerOrNull(Assembly assembly) + public IStringLocalizer? GetLocalizerOrNull(Assembly assembly) { var resourceType = GetResourceType(assembly); return resourceType == null @@ -40,7 +40,7 @@ public class AbpTagHelperLocalizer : IAbpTagHelperLocalizer : _stringLocalizerFactory.Create(resourceType); } - private Type GetResourceType(Assembly assembly) + private Type? GetResourceType(Assembly assembly) { return _options .AssemblyResources diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperService.cs index b9c3aa92e6..95de4f7f51 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/AbpTagHelperService.cs @@ -23,7 +23,7 @@ public abstract class AbpTagHelperService : IAbpTagHelperService { - public string Href { get; set; } + public string? Href { get; set; } - public string Title { get; set; } + public string Title { get; set; } = default!; public bool Active { get; set; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/BreadcrumbItem.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/BreadcrumbItem.cs index 37a194b906..de9f59ca01 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/BreadcrumbItem.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/BreadcrumbItem.cs @@ -2,7 +2,7 @@ public class BreadcrumbItem { - public string Html { get; set; } + public string Html { get; set; } = default!; public bool Active { get; set; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpButtonTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpButtonTagHelper.cs index 624d750274..60c986f34b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpButtonTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpButtonTagHelper.cs @@ -9,11 +9,11 @@ public class AbpButtonTagHelper : AbpTagHelper : AbpTagHelperSe case FontIconType.FontAwesome: return "fa fa-" + TagHelper.Icon; default: - return TagHelper.Icon; + return TagHelper.Icon!; } } @@ -69,7 +69,7 @@ public abstract class AbpButtonTagHelperServiceBase : AbpTagHelperSe } var span = new TagBuilder("span"); - span.InnerHtml.AppendHtml(TagHelper.Text); + span.InnerHtml.AppendHtml(TagHelper.Text!); output.Content.AppendHtml(span); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpLinkButtonTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpLinkButtonTagHelper.cs index bf3b4d8bac..53508864cd 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpLinkButtonTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Button/AbpLinkButtonTagHelper.cs @@ -11,9 +11,9 @@ public class AbpLinkButtonTagHelper : AbpTagHelper { - public string Title { get; set; } + public string? Title { get; set; } - public string Subtitle { get; set; } + public string? Subtitle { get; set; } public AbpCardBodyTagHelper(AbpCardBodyTagHelperService tagHelperService) : base(tagHelperService) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelperService.cs index 172fa778b6..e50d0a791a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelperService.cs @@ -22,7 +22,7 @@ public class AbpCardBodyTagHelperService : AbpTagHelperService { - public string Id { get; set; } + public string? Id { get; set; } public bool? Crossfade { get; set; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs index 9264737b7b..af81b045f5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs @@ -138,7 +138,7 @@ public class AbpCarouselTagHelperService : AbpTagHelperService it.Active) && itemList.Count > 0) { - itemList.FirstOrDefault().Active = true; + itemList.FirstOrDefault()!.Active = true; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelper.cs index 8742631e9a..99dd4ff3a1 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelper.cs @@ -2,9 +2,9 @@ public class AbpAccordionItemTagHelper : AbpTagHelper { - public string Id { get; set; } + public string? Id { get; set; } - public string Title { get; set; } + public string Title { get; set; } = default!; public bool? Active { get; set; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelper.cs index 49cca3199f..a4a87ab32a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelper.cs @@ -2,7 +2,7 @@ public class AbpAccordionTagHelper : AbpTagHelper { - public string Id { get; set; } + public string? Id { get; set; } public AbpAccordionTagHelper(AbpAccordionTagHelperService tagHelperService) : base(tagHelperService) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelper.cs index cd6d5d43ed..477c8ed1d8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelper.cs @@ -2,7 +2,7 @@ public class AbpCollapseBodyTagHelper : AbpTagHelper { - public string Id { get; set; } + public string? Id { get; set; } public bool? Multi { get; set; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseButtonTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseButtonTagHelper.cs index c1219b3bbb..64d90496c3 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseButtonTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseButtonTagHelper.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Collapse; public class AbpCollapseButtonTagHelper : AbpTagHelper { [HtmlAttributeName("abp-collapse-id")] - public string BodyId { get; set; } + public string BodyId { get; set; } = default!; public AbpCollapseButtonTagHelper(AbpCollapseButtonTagHelperService tagHelperService) : base(tagHelperService) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelper.cs index ac87900307..bc0778cb47 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelper.cs @@ -4,7 +4,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown; public class AbpDropdownButtonTagHelper : AbpTagHelper { - public string Text { get; set; } + public string? Text { get; set; } public AbpButtonSize Size { get; set; } = AbpButtonSize.Default; @@ -12,7 +12,7 @@ public class AbpDropdownButtonTagHelper : AbpTagHelper(this ModelExplorer property) where T : Attribute + public static T? GetAttribute(this ModelExplorer property) where T : Attribute { - return property?.Metadata?.ContainerType?.GetTypeInfo()?.GetProperty(property.Metadata.PropertyName)?.GetCustomAttribute(); + return property?.Metadata?.ContainerType?.GetTypeInfo()?.GetProperty(property.Metadata.PropertyName!)?.GetCustomAttribute(); } public static int GetDisplayOrder(this ModelExplorer explorer) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperContextExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperContextExtensions.cs index 47ab8827e7..bda437f8c5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperContextExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperContextExtensions.cs @@ -11,7 +11,7 @@ public static class TagHelperContextExtensions { if (!context.Items.ContainsKey(key)) { - return default(T); + return default(T)!; } return (T)context.Items[key]; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelper.cs index 6f2ed964cb..4e4b86a308 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelper.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; public class AbpDynamicFormTagHelper : AbpTagHelper { [HtmlAttributeName("abp-model")] - public ModelExpression Model { get; set; } + public ModelExpression Model { get; set; } = default!; [HtmlAttributeName("column-size")] public ColumnSize ColumnSize { get; set; } @@ -23,7 +23,7 @@ public class AbpDynamicFormTagHelper : AbpTagHelper _routeValues; + private IDictionary? _routeValues; private const string ActionAttributeName = "asp-action"; private const string AreaAttributeName = "asp-area"; @@ -36,28 +36,28 @@ public class AbpDynamicFormTagHelper : AbpTagHelper RouteValues diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs index 5938ad356d..57fa9fe0fb 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs @@ -201,7 +201,7 @@ public class AbpDynamicFormTagHelperService : AbpTagHelperService(); + var modelAttribute = model.ModelExplorer.GetAttribute()!; var pickerId = modelAttribute.PickerId; @@ -214,16 +214,16 @@ public class AbpDynamicFormTagHelperService : AbpTagHelperService().IsEnd) + if (otherModelExists && otherModel!.GetAttribute()!.IsEnd) { - abpDateRangeInputTagHelper.AspForEnd = ModelExplorerToModelExpressionConverter(otherModel); + abpDateRangeInputTagHelper.AspForEnd = ModelExplorerToModelExpressionConverter(otherModel!); } } return abpDateRangeInputTagHelper; } - private bool TryToGetOtherDateModel(ModelExpression model, string pickerId, out ModelExplorer otherModel) + private bool TryToGetOtherDateModel(ModelExpression model, string pickerId, out ModelExplorer? otherModel) { otherModel = TagHelper.Model.ModelExplorer.Properties.SingleOrDefault(x => x != model.ModelExplorer && x.GetAttribute()?.PickerId == pickerId); return otherModel != null; @@ -266,7 +266,7 @@ public class AbpDynamicFormTagHelperService : AbpTagHelperService(); + var radioButtonAttribute = model.ModelExplorer.GetAttribute()!; var abpRadioInputTagHelper = _serviceProvider.GetRequiredService(); abpRadioInputTagHelper.AspFor = model; abpRadioInputTagHelper.AspItems = null; @@ -356,7 +356,7 @@ public class AbpDynamicFormTagHelperService : AbpTagHelperService -1000 - 1; [HtmlAttributeName("abp-id-name")] - public ModelExpression IdNameFor { get; set; } + public ModelExpression? IdNameFor { get; set; } private readonly MvcViewOptions _mvcViewOptions; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelper.cs index 8c58e3c285..a426b50d33 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelper.cs @@ -6,11 +6,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; public class AbpInputTagHelper : AbpTagHelper { - public ModelExpression AspFor { get; set; } + public ModelExpression AspFor { get; set; } = default!; - public string Label { get; set; } + public string? Label { get; set; } - public string LabelTooltip { get; set; } + public string? LabelTooltip { get; set; } public string LabelTooltipIcon { get; set; } = "bi-info-circle"; @@ -19,7 +19,7 @@ public class AbpInputTagHelper : AbpTagHelper } } - protected virtual TextArea TryGetTextAreaAttribute(TagHelperOutput output) + protected virtual TextArea? TryGetTextAreaAttribute(TagHelperOutput output) { var textAreaAttribute = TagHelper.AspFor.ModelExplorer.GetAttribute