diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj b/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj index fc0586ce8e..03351adb7f 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj +++ b/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.Ddd.Application Volo.Abp.Ddd.Application $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs index 6b6ad975d7..b3a2af6663 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs @@ -70,11 +70,11 @@ public abstract class AbstractKeyCrudAppService Repository { get; } - protected virtual string CreatePolicyName { get; set; } + protected virtual string? CreatePolicyName { get; set; } - protected virtual string UpdatePolicyName { get; set; } + protected virtual string? UpdatePolicyName { get; set; } - protected virtual string DeletePolicyName { get; set; } + protected virtual string? DeletePolicyName { get; set; } protected AbstractKeyCrudAppService(IRepository repository) : base(repository) diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs index e56e3ff042..8602792701 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs @@ -40,9 +40,9 @@ public abstract class AbstractKeyReadOnlyAppService ReadOnlyRepository { get; } - protected virtual string GetPolicyName { get; set; } + protected virtual string? GetPolicyName { get; set; } - protected virtual string GetListPolicyName { get; set; } + protected virtual string? GetListPolicyName { get; set; } protected AbstractKeyReadOnlyAppService(IReadOnlyRepository repository) { @@ -107,7 +107,7 @@ public abstract class AbstractKeyReadOnlyAppService LazyServiceProvider.LazyGetRequiredService(); - protected Type ObjectMapperContext { get; set; } + protected Type? ObjectMapperContext { get; set; } protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService(provider => ObjectMapperContext == null ? provider.GetRequiredService() @@ -85,34 +85,34 @@ public abstract class ApplicationService : return _localizer; } } - private IStringLocalizer _localizer; + private IStringLocalizer? _localizer; - protected Type LocalizationResource { + protected Type? LocalizationResource { get => _localizationResource; set { _localizationResource = value; _localizer = null; } } - private Type _localizationResource = typeof(DefaultResource); + private Type? _localizationResource = typeof(DefaultResource); - protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current; + protected IUnitOfWork? CurrentUnitOfWork => UnitOfWorkManager?.Current; - protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName!) ?? NullLogger.Instance); /// /// Checks for given . /// Throws if given policy has not been granted. /// /// The policy name. This method does nothing if given is null or empty. - protected virtual async Task CheckPolicyAsync([CanBeNull] string policyName) + protected virtual async Task CheckPolicyAsync(string? policyName) { if (string.IsNullOrEmpty(policyName)) { return; } - await AuthorizationService.CheckAsync(policyName); + await AuthorizationService.CheckAsync(policyName!); } protected virtual IStringLocalizer CreateLocalizer()