Browse Source

Merge branch 'dev' into liangshiwei/group8

pull/17109/head
liangshiwei 3 years ago
parent
commit
e5df488d6f
  1. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs
  2. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationFeatureConfigurationDto.cs
  3. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs
  4. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs
  5. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs
  6. 2
      framework/src/Volo.Abp.Auditing.Contracts/Volo.Abp.Auditing.Contracts.csproj
  7. 2
      framework/src/Volo.Abp.Auditing/Volo.Abp.Auditing.csproj
  8. 2
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingOptions.cs
  9. 6
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditLogActionInfo.cs
  10. 24
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditLogInfo.cs
  11. 22
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingHelper.cs
  12. 8
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs
  13. 4
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs
  14. 8
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/EntityChangeInfo.cs
  15. 8
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/EntityPropertyChangeInfo.cs
  16. 10
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingHelper.cs
  17. 3
      framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingManager.cs
  18. 2
      framework/src/Volo.Abp.Authorization.Abstractions/Volo.Abp.Authorization.Abstractions.csproj
  19. 4
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/AlwaysAllowAuthorizationService.cs
  20. 4
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/AlwaysAllowPermissionChecker.cs
  21. 2
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/ICanAddChildPermission.cs
  22. 4
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionChecker.cs
  23. 8
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionContext.cs
  24. 3
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionManager.cs
  25. 16
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinition.cs
  26. 6
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinitionContext.cs
  27. 6
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionGrantInfo.cs
  28. 17
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionGroupDefinition.cs
  29. 4
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionStateContext.cs
  30. 5
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionValueCheckContext.cs
  31. 5
      framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionValuesCheckContext.cs
  32. 4
      framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs
  33. 4
      framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AuthorizationOptionsExtensions.cs
  34. 2
      framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj
  35. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs
  36. 4
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/AuthenticatedSimpleStateCheckerSerializerContributor.cs
  37. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IDynamicPermissionDefinitionStore.cs
  38. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IStaticPermissionDefinitionStore.cs
  39. 4
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/NullDynamicPermissionDefinitionStore.cs
  40. 4
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs
  41. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinitionManager.cs
  42. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionValueProviderManager.cs
  43. 6
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionsSimpleStateCheckerSerializerContributor.cs
  44. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RequirePermissionsSimpleBatchStateChecker.cs
  45. 4
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/StaticPermissionDefinitionStore.cs
  46. 2
      framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleDtoExtensions.cs
  47. 2
      framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj
  48. 2
      framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/MapperAccessor.cs
  49. 2
      framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj
  50. 2
      framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
  51. 2
      framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs
  52. 8
      framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJobArgs.cs
  53. 4
      framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs
  54. 2
      framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderConfiguration.cs
  55. 8
      framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/IEmailSender.cs
  56. 2
      framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/ISmtpEmailSenderConfiguration.cs
  57. 2
      framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSenderConfiguration.cs
  58. 6
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs
  59. 2
      framework/src/Volo.Abp.Features/Volo.Abp.Features.csproj
  60. 4
      framework/src/Volo.Abp.Features/Volo/Abp/Features/DefaultValueFeatureValueProvider.cs
  61. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs
  62. 6
      framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs
  63. 4
      framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs
  64. 45
      framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs
  65. 4
      framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinitionContext.cs
  66. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinitionManager.cs
  67. 26
      framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureGroupDefinition.cs
  68. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureValueProvider.cs
  69. 6
      framework/src/Volo.Abp.Features/Volo/Abp/Features/FeaturesSimpleStateCheckerSerializerContributor.cs
  70. 8
      framework/src/Volo.Abp.Features/Volo/Abp/Features/ICanCreateChildFeature.cs
  71. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/IDynamicFeatureDefinitionStore.cs
  72. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/IFeatureChecker.cs
  73. 4
      framework/src/Volo.Abp.Features/Volo/Abp/Features/IFeatureDefinitionContext.cs
  74. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/IFeatureDefinitionManager.cs
  75. 6
      framework/src/Volo.Abp.Features/Volo/Abp/Features/IFeatureStore.cs
  76. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/IFeatureValueProvider.cs
  77. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/IStaticFeatureDefinitionStore.cs
  78. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/MethodInvocationFeatureCheckerService.cs
  79. 4
      framework/src/Volo.Abp.Features/Volo/Abp/Features/NullDynamicFeatureDefinitionStore.cs
  80. 4
      framework/src/Volo.Abp.Features/Volo/Abp/Features/NullFeatureStore.cs
  81. 4
      framework/src/Volo.Abp.Features/Volo/Abp/Features/StaticFeatureDefinitionStore.cs
  82. 2
      framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs
  83. 2
      framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj
  84. 6
      framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/AbpFluentValidationConventionalRegistrar.cs
  85. 2
      framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/FluentObjectValidationContributor.cs
  86. 2
      framework/src/Volo.Abp.Gdpr.Abstractions/Volo.Abp.Gdpr.Abstractions.csproj
  87. 4
      framework/src/Volo.Abp.Gdpr.Abstractions/Volo/Abp/Gdpr/GdprUserDataPreparedEto.cs
  88. 2
      framework/src/Volo.Abp.GlobalFeatures/Volo.Abp.GlobalFeatures.csproj
  89. 4
      framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnabledException.cs
  90. 2
      framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureHelper.cs
  91. 4
      framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureInterceptor.cs
  92. 6
      framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeaturesSimpleStateCheckerSerializerContributor.cs
  93. 6
      framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/RequiresGlobalFeatureAttribute.cs
  94. 2
      framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj
  95. 2
      framework/src/Volo.Abp.ObjectMapping/Volo.Abp.ObjectMapping.csproj
  96. 6
      framework/src/Volo.Abp.ObjectMapping/Volo/Abp/ObjectMapping/DefaultObjectMapper.cs
  97. 8
      framework/src/Volo.Abp.ObjectMapping/Volo/Abp/ObjectMapping/ObjectMapperExtensions.cs
  98. 4
      framework/src/Volo.Abp.Swashbuckle/Microsoft/AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs
  99. 12
      framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs
  100. 2
      framework/src/Volo.Abp.Swashbuckle/Volo.Abp.Swashbuckle.csproj

4
framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs

@ -21,7 +21,7 @@ public class RemotePermissionChecker : IPermissionChecker, ITransientDependency
return configuration.Auth.GrantedPolicies.ContainsKey(name); return configuration.Auth.GrantedPolicies.ContainsKey(name);
} }
public async Task<bool> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name) public async Task<bool> IsGrantedAsync(ClaimsPrincipal? claimsPrincipal, string name)
{ {
/* This provider always works for the current principal. */ /* This provider always works for the current principal. */
return await IsGrantedAsync(name); return await IsGrantedAsync(name);
@ -41,7 +41,7 @@ public class RemotePermissionChecker : IPermissionChecker, ITransientDependency
return result; return result;
} }
public async Task<MultiplePermissionGrantResult> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string[] names) public async Task<MultiplePermissionGrantResult> IsGrantedAsync(ClaimsPrincipal? claimsPrincipal, string[] names)
{ {
/* This provider always works for the current principal. */ /* This provider always works for the current principal. */
return await IsGrantedAsync(names); return await IsGrantedAsync(names);

4
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationFeatureConfigurationDto.cs

@ -6,10 +6,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations;
[Serializable] [Serializable]
public class ApplicationFeatureConfigurationDto public class ApplicationFeatureConfigurationDto
{ {
public Dictionary<string, string> Values { get; set; } public Dictionary<string, string?> Values { get; set; }
public ApplicationFeatureConfigurationDto() public ApplicationFeatureConfigurationDto()
{ {
Values = new Dictionary<string, string>(); Values = new Dictionary<string, string?>();
} }
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs

@ -56,7 +56,7 @@ public class ToolbarManager : IToolbarManager, ITransientDependency
{ {
foreach (var item in toolbar.Items.Where(x => !x.RequiredPermissionName.IsNullOrWhiteSpace())) foreach (var item in toolbar.Items.Where(x => !x.RequiredPermissionName.IsNullOrWhiteSpace()))
{ {
item.RequirePermissions(item.RequiredPermissionName); item.RequirePermissions(item.RequiredPermissionName!);
} }
var checkPermissionsToolbarItems = toolbar.Items.Where(x => x.StateCheckers.Any()).ToArray(); var checkPermissionsToolbarItems = toolbar.Items.Where(x => x.StateCheckers.Any()).ToArray();

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs

@ -24,7 +24,7 @@ public class GlobalFeatureActionFilter : IAsyncActionFilter, ITransientDependenc
if (!GlobalFeatureHelper.IsGlobalFeatureEnabled(context.Controller.GetType(), out var attribute)) if (!GlobalFeatureHelper.IsGlobalFeatureEnabled(context.Controller.GetType(), out var attribute))
{ {
var logger = context.GetService<ILogger<GlobalFeatureActionFilter>>(NullLogger<GlobalFeatureActionFilter>.Instance)!; var logger = context.GetService<ILogger<GlobalFeatureActionFilter>>(NullLogger<GlobalFeatureActionFilter>.Instance)!;
logger.LogWarning($"The '{context.Controller.GetType().FullName}' controller needs to enable '{attribute.Name}' feature."); logger.LogWarning($"The '{context.Controller.GetType().FullName}' controller needs to enable '{attribute!.Name}' feature.");
context.Result = new NotFoundResult(); context.Result = new NotFoundResult();
return; return;
} }

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs

@ -29,7 +29,7 @@ public class GlobalFeaturePageFilter : IAsyncPageFilter, ITransientDependency
if (!GlobalFeatureHelper.IsGlobalFeatureEnabled(context.HandlerInstance.GetType(), out var attribute)) if (!GlobalFeatureHelper.IsGlobalFeatureEnabled(context.HandlerInstance.GetType(), out var attribute))
{ {
var logger = context.GetService<ILogger<GlobalFeatureActionFilter>>(NullLogger<GlobalFeatureActionFilter>.Instance)!; var logger = context.GetService<ILogger<GlobalFeatureActionFilter>>(NullLogger<GlobalFeatureActionFilter>.Instance)!;
logger.LogWarning($"The '{context.HandlerInstance.GetType().FullName}' page needs to enable '{attribute.Name}' feature."); logger.LogWarning($"The '{context.HandlerInstance.GetType().FullName}' page needs to enable '{attribute!.Name}' feature.");
context.Result = new NotFoundResult(); context.Result = new NotFoundResult();
return; return;
} }

2
framework/src/Volo.Abp.Auditing.Contracts/Volo.Abp.Auditing.Contracts.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Auditing.Contracts</AssemblyName> <AssemblyName>Volo.Abp.Auditing.Contracts</AssemblyName>
<PackageId>Volo.Abp.Auditing.Contracts</PackageId> <PackageId>Volo.Abp.Auditing.Contracts</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

2
framework/src/Volo.Abp.Auditing/Volo.Abp.Auditing.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Auditing</AssemblyName> <AssemblyName>Volo.Abp.Auditing</AssemblyName>
<PackageId>Volo.Abp.Auditing</PackageId> <PackageId>Volo.Abp.Auditing</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

2
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingOptions.cs

@ -26,7 +26,7 @@ public class AbpAuditingOptions
/// The name of the application or service writing audit logs. /// The name of the application or service writing audit logs.
/// Default: null. /// Default: null.
/// </summary> /// </summary>
public string ApplicationName { get; set; } public string? ApplicationName { get; set; }
/// <summary> /// <summary>
/// Default: true. /// Default: true.

6
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditLogActionInfo.cs

@ -7,11 +7,11 @@ namespace Volo.Abp.Auditing;
[Serializable] [Serializable]
public class AuditLogActionInfo : IHasExtraProperties public class AuditLogActionInfo : IHasExtraProperties
{ {
public string ServiceName { get; set; } public string ServiceName { get; set; } = default!;
public string MethodName { get; set; } public string MethodName { get; set; } = default!;
public string Parameters { get; set; } public string Parameters { get; set; } = default!;
public DateTime ExecutionTime { get; set; } public DateTime ExecutionTime { get; set; }

24
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditLogInfo.cs

@ -9,43 +9,43 @@ namespace Volo.Abp.Auditing;
[Serializable] [Serializable]
public class AuditLogInfo : IHasExtraProperties public class AuditLogInfo : IHasExtraProperties
{ {
public string ApplicationName { get; set; } public string? ApplicationName { get; set; }
public Guid? UserId { get; set; } public Guid? UserId { get; set; }
public string UserName { get; set; } public string? UserName { get; set; }
public Guid? TenantId { get; set; } public Guid? TenantId { get; set; }
public string TenantName { get; set; } public string? TenantName { get; set; }
public Guid? ImpersonatorUserId { get; set; } public Guid? ImpersonatorUserId { get; set; }
public Guid? ImpersonatorTenantId { get; set; } 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 DateTime ExecutionTime { get; set; } public DateTime ExecutionTime { get; set; }
public int ExecutionDuration { get; set; } public int ExecutionDuration { get; set; }
public string ClientId { get; set; } public string? ClientId { get; set; }
public string CorrelationId { get; set; } public string? CorrelationId { get; set; }
public string ClientIpAddress { get; set; } public string? ClientIpAddress { get; set; }
public string ClientName { get; set; } public string? ClientName { get; set; }
public string BrowserInfo { get; set; } public string? BrowserInfo { get; set; }
public string HttpMethod { get; set; } public string? HttpMethod { get; set; }
public int? HttpStatusCode { get; set; } public int? HttpStatusCode { get; set; }
public string Url { get; set; } public string? Url { get; set; }
public List<AuditLogActionInfo> Actions { get; set; } public List<AuditLogActionInfo> Actions { get; set; }

22
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingHelper.cs

@ -52,7 +52,7 @@ public class AuditingHelper : IAuditingHelper, ITransientDependency
CorrelationIdProvider = correlationIdProvider; CorrelationIdProvider = correlationIdProvider;
} }
public virtual bool ShouldSaveAudit(MethodInfo methodInfo, bool defaultValue = false, bool ignoreIntegrationServiceAttribute = false) public virtual bool ShouldSaveAudit(MethodInfo? methodInfo, bool defaultValue = false, bool ignoreIntegrationServiceAttribute = false)
{ {
if (methodInfo == null) if (methodInfo == null)
{ {
@ -150,23 +150,23 @@ public class AuditingHelper : IAuditingHelper, ITransientDependency
public virtual AuditLogActionInfo CreateAuditLogAction( public virtual AuditLogActionInfo CreateAuditLogAction(
AuditLogInfo auditLog, AuditLogInfo auditLog,
Type type, Type? type,
MethodInfo method, MethodInfo method,
object[] arguments) object?[] arguments)
{ {
return CreateAuditLogAction(auditLog, type, method, CreateArgumentsDictionary(method, arguments)); return CreateAuditLogAction(auditLog, type, method, CreateArgumentsDictionary(method, arguments));
} }
public virtual AuditLogActionInfo CreateAuditLogAction( public virtual AuditLogActionInfo CreateAuditLogAction(
AuditLogInfo auditLog, AuditLogInfo auditLog,
Type type, Type? type,
MethodInfo method, MethodInfo method,
IDictionary<string, object> arguments) IDictionary<string, object?> arguments)
{ {
var actionInfo = new AuditLogActionInfo var actionInfo = new AuditLogActionInfo
{ {
ServiceName = type != null ServiceName = type != null
? type.FullName ? type.FullName!
: "", : "",
MethodName = method.Name, MethodName = method.Name,
Parameters = SerializeConvertArguments(arguments), Parameters = SerializeConvertArguments(arguments),
@ -198,7 +198,7 @@ public class AuditingHelper : IAuditingHelper, ITransientDependency
} }
} }
protected virtual string SerializeConvertArguments(IDictionary<string, object> arguments) protected virtual string SerializeConvertArguments(IDictionary<string, object?> arguments)
{ {
try try
{ {
@ -207,7 +207,7 @@ public class AuditingHelper : IAuditingHelper, ITransientDependency
return "{}"; return "{}";
} }
var dictionary = new Dictionary<string, object>(); var dictionary = new Dictionary<string, object?>();
foreach (var argument in arguments) foreach (var argument in arguments)
{ {
@ -230,14 +230,14 @@ public class AuditingHelper : IAuditingHelper, ITransientDependency
} }
} }
protected virtual Dictionary<string, object> CreateArgumentsDictionary(MethodInfo method, object[] arguments) protected virtual Dictionary<string, object?> CreateArgumentsDictionary(MethodInfo method, object?[] arguments)
{ {
var parameters = method.GetParameters(); var parameters = method.GetParameters();
var dictionary = new Dictionary<string, object>(); var dictionary = new Dictionary<string, object?>();
for (var i = 0; i < parameters.Length; i++) for (var i = 0; i < parameters.Length; i++)
{ {
dictionary[parameters[i].Name] = arguments[i]; dictionary[parameters[i].Name!] = arguments[i];
} }
return dictionary; return dictionary;

8
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs

@ -80,7 +80,7 @@ public class AuditingInterceptor : AbpInterceptor, ITransientDependency
{ {
var auditLog = auditLogScope.Log; var auditLog = auditLogScope.Log;
AuditLogActionInfo auditLogAction = null; AuditLogActionInfo? auditLogAction = null;
if (!options.DisableLogActionInfo) if (!options.DisableLogActionInfo)
{ {
auditLogAction = auditingHelper.CreateAuditLogAction( auditLogAction = auditingHelper.CreateAuditLogAction(
@ -127,10 +127,10 @@ public class AuditingInterceptor : AbpInterceptor, ITransientDependency
{ {
try try
{ {
await ProceedByLoggingAsync(invocation, options, auditingHelper, auditingManager.Current); await ProceedByLoggingAsync(invocation, options, auditingHelper, auditingManager.Current!);
Debug.Assert(auditingManager.Current != null); Debug.Assert(auditingManager.Current != null);
if (auditingManager.Current.Log.Exceptions.Any()) if (auditingManager.Current!.Log.Exceptions.Any())
{ {
hasError = true; hasError = true;
} }
@ -142,7 +142,7 @@ public class AuditingInterceptor : AbpInterceptor, ITransientDependency
} }
finally finally
{ {
if (await ShouldWriteAuditLogAsync(invocation, auditingManager.Current.Log, options, currentUser, hasError)) if (await ShouldWriteAuditLogAsync(invocation, auditingManager.Current!.Log, options, currentUser, hasError))
{ {
if (unitOfWorkManager.Current != null) if (unitOfWorkManager.Current != null)
{ {

4
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs

@ -38,7 +38,7 @@ public class AuditingManager : IAuditingManager, ITransientDependency
_auditingStore = auditingStore; _auditingStore = auditingStore;
} }
public IAuditLogScope Current => _ambientScopeProvider.GetValue(AmbientContextKey); public IAuditLogScope? Current => _ambientScopeProvider.GetValue(AmbientContextKey);
public IAuditLogSaveHandle BeginScope() public IAuditLogSaveHandle BeginScope()
{ {
@ -49,7 +49,7 @@ public class AuditingManager : IAuditingManager, ITransientDependency
Debug.Assert(Current != null, "Current != null"); Debug.Assert(Current != null, "Current != null");
return new DisposableSaveHandle(this, ambientScope, Current.Log, Stopwatch.StartNew()); return new DisposableSaveHandle(this, ambientScope, Current!.Log, Stopwatch.StartNew());
} }
protected virtual void ExecutePostContributors(AuditLogInfo auditLogInfo) protected virtual void ExecutePostContributors(AuditLogInfo auditLogInfo)

8
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/EntityChangeInfo.cs

@ -19,15 +19,15 @@ public class EntityChangeInfo : IHasExtraProperties
/// </summary> /// </summary>
public Guid? EntityTenantId { get; set; } public Guid? EntityTenantId { get; set; }
public string EntityId { get; set; } public string? EntityId { get; set; }
public string EntityTypeFullName { get; set; } public string? EntityTypeFullName { get; set; }
public List<EntityPropertyChangeInfo> PropertyChanges { get; set; } public List<EntityPropertyChangeInfo> PropertyChanges { get; set; } = default!;
public ExtraPropertyDictionary ExtraProperties { get; } public ExtraPropertyDictionary ExtraProperties { get; }
public virtual object EntityEntry { get; set; } //TODO: Try to remove since it breaks serializability public virtual object EntityEntry { get; set; } = default!; //TODO: Try to remove since it breaks serializability
public EntityChangeInfo() public EntityChangeInfo()
{ {

8
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/EntityPropertyChangeInfo.cs

@ -23,11 +23,11 @@ public class EntityPropertyChangeInfo
/// </summary> /// </summary>
public static int MaxPropertyTypeFullNameLength = 192; public static int MaxPropertyTypeFullNameLength = 192;
public virtual string NewValue { get; set; } public virtual string? NewValue { get; set; }
public virtual string OriginalValue { get; set; } public virtual string? OriginalValue { get; set; }
public virtual string PropertyName { get; set; } public virtual string PropertyName { get; set; } = default!;
public virtual string PropertyTypeFullName { get; set; } public virtual string PropertyTypeFullName { get; set; } = default!;
} }

10
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingHelper.cs

@ -7,7 +7,7 @@ namespace Volo.Abp.Auditing;
//TODO: Move ShouldSaveAudit & IsEntityHistoryEnabled and rename to IAuditingFactory //TODO: Move ShouldSaveAudit & IsEntityHistoryEnabled and rename to IAuditingFactory
public interface IAuditingHelper public interface IAuditingHelper
{ {
bool ShouldSaveAudit(MethodInfo methodInfo, bool defaultValue = false, bool ignoreIntegrationServiceAttribute = false); bool ShouldSaveAudit(MethodInfo? methodInfo, bool defaultValue = false, bool ignoreIntegrationServiceAttribute = false);
bool IsEntityHistoryEnabled(Type entityType, bool defaultValue = false); bool IsEntityHistoryEnabled(Type entityType, bool defaultValue = false);
@ -15,15 +15,15 @@ public interface IAuditingHelper
AuditLogActionInfo CreateAuditLogAction( AuditLogActionInfo CreateAuditLogAction(
AuditLogInfo auditLog, AuditLogInfo auditLog,
Type type, Type? type,
MethodInfo method, MethodInfo method,
object[] arguments object?[] arguments
); );
AuditLogActionInfo CreateAuditLogAction( AuditLogActionInfo CreateAuditLogAction(
AuditLogInfo auditLog, AuditLogInfo auditLog,
Type type, Type? type,
MethodInfo method, MethodInfo method,
IDictionary<string, object> arguments IDictionary<string, object?> arguments
); );
} }

3
framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingManager.cs

@ -4,8 +4,7 @@ namespace Volo.Abp.Auditing;
public interface IAuditingManager public interface IAuditingManager
{ {
[CanBeNull] IAuditLogScope? Current { get; }
IAuditLogScope Current { get; }
IAuditLogSaveHandle BeginScope(); IAuditLogSaveHandle BeginScope();
} }

2
framework/src/Volo.Abp.Authorization.Abstractions/Volo.Abp.Authorization.Abstractions.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Authorization.Abstractions</AssemblyName> <AssemblyName>Volo.Abp.Authorization.Abstractions</AssemblyName>
<PackageId>Volo.Abp.Authorization.Abstractions</PackageId> <PackageId>Volo.Abp.Authorization.Abstractions</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

4
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/AlwaysAllowAuthorizationService.cs

@ -21,12 +21,12 @@ public class AlwaysAllowAuthorizationService : IAbpAuthorizationService
_currentPrincipalAccessor = currentPrincipalAccessor; _currentPrincipalAccessor = currentPrincipalAccessor;
} }
public Task<AuthorizationResult> AuthorizeAsync(ClaimsPrincipal user, object resource, IEnumerable<IAuthorizationRequirement> requirements) public Task<AuthorizationResult> AuthorizeAsync(ClaimsPrincipal user, object? resource, IEnumerable<IAuthorizationRequirement> requirements)
{ {
return Task.FromResult(AuthorizationResult.Success()); return Task.FromResult(AuthorizationResult.Success());
} }
public Task<AuthorizationResult> AuthorizeAsync(ClaimsPrincipal user, object resource, string policyName) public Task<AuthorizationResult> AuthorizeAsync(ClaimsPrincipal user, object? resource, string policyName)
{ {
return Task.FromResult(AuthorizationResult.Success()); return Task.FromResult(AuthorizationResult.Success());
} }

4
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/AlwaysAllowPermissionChecker.cs

@ -17,7 +17,7 @@ public class AlwaysAllowPermissionChecker : IPermissionChecker
return TaskCache.TrueResult; return TaskCache.TrueResult;
} }
public Task<bool> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name) public Task<bool> IsGrantedAsync(ClaimsPrincipal? claimsPrincipal, string name)
{ {
return TaskCache.TrueResult; return TaskCache.TrueResult;
} }
@ -27,7 +27,7 @@ public class AlwaysAllowPermissionChecker : IPermissionChecker
return IsGrantedAsync(null, names); return IsGrantedAsync(null, names);
} }
public Task<MultiplePermissionGrantResult> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string[] names) public Task<MultiplePermissionGrantResult> IsGrantedAsync(ClaimsPrincipal? claimsPrincipal, string[] names)
{ {
return Task.FromResult(new MultiplePermissionGrantResult(names, PermissionGrantResult.Granted)); return Task.FromResult(new MultiplePermissionGrantResult(names, PermissionGrantResult.Granted));
} }

2
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/ICanAddChildPermission.cs

@ -8,7 +8,7 @@ public interface ICanAddChildPermission
{ {
PermissionDefinition AddPermission( PermissionDefinition AddPermission(
[NotNull] string name, [NotNull] string name,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
MultiTenancySides multiTenancySide = MultiTenancySides.Both, MultiTenancySides multiTenancySide = MultiTenancySides.Both,
bool isEnabled = true); bool isEnabled = true);
} }

4
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionChecker.cs

@ -8,9 +8,9 @@ public interface IPermissionChecker
{ {
Task<bool> IsGrantedAsync([NotNull] string name); Task<bool> IsGrantedAsync([NotNull] string name);
Task<bool> IsGrantedAsync([CanBeNull] ClaimsPrincipal claimsPrincipal, [NotNull] string name); Task<bool> IsGrantedAsync(ClaimsPrincipal? claimsPrincipal, [NotNull] string name);
Task<MultiplePermissionGrantResult> IsGrantedAsync([NotNull] string[] names); Task<MultiplePermissionGrantResult> IsGrantedAsync([NotNull] string[] names);
Task<MultiplePermissionGrantResult> IsGrantedAsync([CanBeNull] ClaimsPrincipal claimsPrincipal, [NotNull] string[] names); Task<MultiplePermissionGrantResult> IsGrantedAsync(ClaimsPrincipal? claimsPrincipal, [NotNull] string[] names);
} }

8
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionContext.cs

@ -25,8 +25,7 @@ public interface IPermissionDefinitionContext
/// </summary> /// </summary>
/// <param name="name">Name of the group</param> /// <param name="name">Name of the group</param>
/// <returns></returns> /// <returns></returns>
[CanBeNull] PermissionGroupDefinition? GetGroupOrNull(string name);
PermissionGroupDefinition GetGroupOrNull(string name);
/// <summary> /// <summary>
/// Tries to add a new permission group. /// Tries to add a new permission group.
@ -37,7 +36,7 @@ public interface IPermissionDefinitionContext
/// </summary> /// </summary>
PermissionGroupDefinition AddGroup( PermissionGroupDefinition AddGroup(
[NotNull] string name, [NotNull] string name,
ILocalizableString displayName = null); ILocalizableString? displayName = null);
/// <summary> /// <summary>
/// Tries to remove a permission group. /// Tries to remove a permission group.
@ -51,6 +50,5 @@ public interface IPermissionDefinitionContext
/// Returns null if can not find the given group. /// Returns null if can not find the given group.
/// <param name="name">Name of the group</param> /// <param name="name">Name of the group</param>
/// </summary> /// </summary>
[CanBeNull] PermissionDefinition? GetPermissionOrNull([NotNull] string name);
PermissionDefinition GetPermissionOrNull([NotNull] string name);
} }

3
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionManager.cs

@ -9,8 +9,7 @@ public interface IPermissionDefinitionManager
[ItemNotNull] [ItemNotNull]
Task<PermissionDefinition> GetAsync([NotNull] string name); Task<PermissionDefinition> GetAsync([NotNull] string name);
[ItemCanBeNull] Task<PermissionDefinition?> GetOrNullAsync([NotNull] string name);
Task<PermissionDefinition> GetOrNullAsync([NotNull] string name);
Task<IReadOnlyList<PermissionDefinition>> GetPermissionsAsync(); Task<IReadOnlyList<PermissionDefinition>> GetPermissionsAsync();

16
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinition.cs

@ -20,7 +20,7 @@ public class PermissionDefinition :
/// Parent of this permission if one exists. /// Parent of this permission if one exists.
/// If set, this permission can be granted only if parent is granted. /// If set, this permission can be granted only if parent is granted.
/// </summary> /// </summary>
public PermissionDefinition Parent { get; private set; } public PermissionDefinition? Parent { get; private set; }
/// <summary> /// <summary>
/// MultiTenancy side. /// MultiTenancy side.
@ -40,7 +40,7 @@ public class PermissionDefinition :
get => _displayName; get => _displayName;
set => _displayName = Check.NotNull(value, nameof(value)); set => _displayName = Check.NotNull(value, nameof(value));
} }
private ILocalizableString _displayName; private ILocalizableString _displayName = default!;
public IReadOnlyList<PermissionDefinition> Children => _children.ToImmutableList(); public IReadOnlyList<PermissionDefinition> Children => _children.ToImmutableList();
private readonly List<PermissionDefinition> _children; private readonly List<PermissionDefinition> _children;
@ -48,7 +48,7 @@ public class PermissionDefinition :
/// <summary> /// <summary>
/// Can be used to get/set custom properties for this permission definition. /// Can be used to get/set custom properties for this permission definition.
/// </summary> /// </summary>
public Dictionary<string, object> Properties { get; } public Dictionary<string, object?> Properties { get; }
/// <summary> /// <summary>
/// Indicates whether this permission is enabled or disabled. /// Indicates whether this permission is enabled or disabled.
@ -71,14 +71,14 @@ public class PermissionDefinition :
/// Returns the value in the <see cref="Properties"/> dictionary by given <paramref name="name"/>. /// Returns the value in the <see cref="Properties"/> dictionary by given <paramref name="name"/>.
/// Returns null if given <paramref name="name"/> is not present in the <see cref="Properties"/> dictionary. /// Returns null if given <paramref name="name"/> is not present in the <see cref="Properties"/> dictionary.
/// </returns> /// </returns>
public object this[string name] { public object? this[string name] {
get => Properties.GetOrDefault(name); get => Properties.GetOrDefault(name);
set => Properties[name] = value; set => Properties[name] = value;
} }
protected internal PermissionDefinition( protected internal PermissionDefinition(
[NotNull] string name, [NotNull] string name,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
MultiTenancySides multiTenancySide = MultiTenancySides.Both, MultiTenancySides multiTenancySide = MultiTenancySides.Both,
bool isEnabled = true) bool isEnabled = true)
{ {
@ -87,7 +87,7 @@ public class PermissionDefinition :
MultiTenancySide = multiTenancySide; MultiTenancySide = multiTenancySide;
IsEnabled = isEnabled; IsEnabled = isEnabled;
Properties = new Dictionary<string, object>(); Properties = new Dictionary<string, object?>();
Providers = new List<string>(); Providers = new List<string>();
StateCheckers = new List<ISimpleStateChecker<PermissionDefinition>>(); StateCheckers = new List<ISimpleStateChecker<PermissionDefinition>>();
_children = new List<PermissionDefinition>(); _children = new List<PermissionDefinition>();
@ -95,7 +95,7 @@ public class PermissionDefinition :
public virtual PermissionDefinition AddChild( public virtual PermissionDefinition AddChild(
[NotNull] string name, [NotNull] string name,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
MultiTenancySides multiTenancySide = MultiTenancySides.Both, MultiTenancySides multiTenancySide = MultiTenancySides.Both,
bool isEnabled = true) bool isEnabled = true)
{ {
@ -115,7 +115,7 @@ public class PermissionDefinition :
PermissionDefinition ICanAddChildPermission.AddPermission( PermissionDefinition ICanAddChildPermission.AddPermission(
string name, string name,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
MultiTenancySides multiTenancySide = MultiTenancySides.Both, MultiTenancySides multiTenancySide = MultiTenancySides.Both,
bool isEnabled = true) bool isEnabled = true)
{ {

6
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionDefinitionContext.cs

@ -20,7 +20,7 @@ public class PermissionDefinitionContext : IPermissionDefinitionContext
public virtual PermissionGroupDefinition AddGroup( public virtual PermissionGroupDefinition AddGroup(
string name, string name,
ILocalizableString displayName = null) ILocalizableString? displayName = null)
{ {
Check.NotNull(name, nameof(name)); Check.NotNull(name, nameof(name));
@ -45,7 +45,7 @@ public class PermissionDefinitionContext : IPermissionDefinitionContext
return group; return group;
} }
public virtual PermissionGroupDefinition GetGroupOrNull([NotNull] string name) public virtual PermissionGroupDefinition? GetGroupOrNull([NotNull] string name)
{ {
Check.NotNull(name, nameof(name)); Check.NotNull(name, nameof(name));
@ -69,7 +69,7 @@ public class PermissionDefinitionContext : IPermissionDefinitionContext
Groups.Remove(name); Groups.Remove(name);
} }
public virtual PermissionDefinition GetPermissionOrNull([NotNull] string name) public virtual PermissionDefinition? GetPermissionOrNull([NotNull] string name)
{ {
Check.NotNull(name, nameof(name)); Check.NotNull(name, nameof(name));

6
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionGrantInfo.cs

@ -8,11 +8,11 @@ public class PermissionGrantInfo
public bool IsGranted { get; } public bool IsGranted { get; }
public string ProviderName { get; } public string? ProviderName { get; }
public string ProviderKey { get; } public string? ProviderKey { get; }
public PermissionGrantInfo([NotNull] string name, bool isGranted, [CanBeNull] string providerName = null, [CanBeNull] string providerKey = null) public PermissionGrantInfo([NotNull] string name, bool isGranted, string? providerName = null, string? providerKey = null)
{ {
Check.NotNull(name, nameof(name)); Check.NotNull(name, nameof(name));

17
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionGroupDefinition.cs

@ -13,13 +13,13 @@ public class PermissionGroupDefinition : ICanAddChildPermission
/// </summary> /// </summary>
public string Name { get; } public string Name { get; }
public Dictionary<string, object> Properties { get; } public Dictionary<string, object?> Properties { get; }
public ILocalizableString DisplayName { public ILocalizableString DisplayName {
get => _displayName; get => _displayName;
set => _displayName = Check.NotNull(value, nameof(value)); set => _displayName = Check.NotNull(value, nameof(value));
} }
private ILocalizableString _displayName; private ILocalizableString _displayName = default!;
public IReadOnlyList<PermissionDefinition> Permissions => _permissions.ToImmutableList(); public IReadOnlyList<PermissionDefinition> Permissions => _permissions.ToImmutableList();
private readonly List<PermissionDefinition> _permissions; private readonly List<PermissionDefinition> _permissions;
@ -32,25 +32,25 @@ public class PermissionGroupDefinition : ICanAddChildPermission
/// Returns the value in the <see cref="Properties"/> dictionary by given <paramref name="name"/>. /// Returns the value in the <see cref="Properties"/> dictionary by given <paramref name="name"/>.
/// Returns null if given <paramref name="name"/> is not present in the <see cref="Properties"/> dictionary. /// Returns null if given <paramref name="name"/> is not present in the <see cref="Properties"/> dictionary.
/// </returns> /// </returns>
public object this[string name] { public object? this[string name] {
get => Properties.GetOrDefault(name); get => Properties.GetOrDefault(name);
set => Properties[name] = value; set => Properties[name] = value;
} }
protected internal PermissionGroupDefinition( protected internal PermissionGroupDefinition(
string name, string name,
ILocalizableString displayName = null) ILocalizableString? displayName = null)
{ {
Name = name; Name = name;
DisplayName = displayName ?? new FixedLocalizableString(Name); DisplayName = displayName ?? new FixedLocalizableString(Name);
Properties = new Dictionary<string, object>(); Properties = new Dictionary<string, object?>();
_permissions = new List<PermissionDefinition>(); _permissions = new List<PermissionDefinition>();
} }
public virtual PermissionDefinition AddPermission( public virtual PermissionDefinition AddPermission(
[NotNull] string name, [NotNull] string name,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
MultiTenancySides multiTenancySide = MultiTenancySides.Both, MultiTenancySides multiTenancySide = MultiTenancySides.Both,
bool isEnabled = true) bool isEnabled = true)
{ {
@ -93,15 +93,14 @@ public class PermissionGroupDefinition : ICanAddChildPermission
return $"[{nameof(PermissionGroupDefinition)} {Name}]"; return $"[{nameof(PermissionGroupDefinition)} {Name}]";
} }
[CanBeNull] public PermissionDefinition? GetPermissionOrNull([NotNull] string name)
public PermissionDefinition GetPermissionOrNull([NotNull] string name)
{ {
Check.NotNull(name, nameof(name)); Check.NotNull(name, nameof(name));
return GetPermissionOrNullRecursively(Permissions, name); return GetPermissionOrNullRecursively(Permissions, name);
} }
private PermissionDefinition GetPermissionOrNullRecursively( private PermissionDefinition? GetPermissionOrNullRecursively(
IReadOnlyList<PermissionDefinition> permissions, string name) IReadOnlyList<PermissionDefinition> permissions, string name)
{ {
foreach (var permission in permissions) foreach (var permission in permissions)

4
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionStateContext.cs

@ -4,7 +4,7 @@ namespace Volo.Abp.Authorization.Permissions;
public class PermissionStateContext public class PermissionStateContext
{ {
public IServiceProvider ServiceProvider { get; set; } public IServiceProvider ServiceProvider { get; set; } = default!;
public PermissionDefinition Permission { get; set; } public PermissionDefinition Permission { get; set; } = default!;
} }

5
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionValueCheckContext.cs

@ -8,12 +8,11 @@ public class PermissionValueCheckContext
[NotNull] [NotNull]
public PermissionDefinition Permission { get; } public PermissionDefinition Permission { get; }
[CanBeNull] public ClaimsPrincipal? Principal { get; }
public ClaimsPrincipal Principal { get; }
public PermissionValueCheckContext( public PermissionValueCheckContext(
[NotNull] PermissionDefinition permission, [NotNull] PermissionDefinition permission,
[CanBeNull] ClaimsPrincipal principal) ClaimsPrincipal? principal)
{ {
Check.NotNull(permission, nameof(permission)); Check.NotNull(permission, nameof(permission));

5
framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/PermissionValuesCheckContext.cs

@ -9,12 +9,11 @@ public class PermissionValuesCheckContext
[NotNull] [NotNull]
public List<PermissionDefinition> Permissions { get; } public List<PermissionDefinition> Permissions { get; }
[CanBeNull] public ClaimsPrincipal? Principal { get; }
public ClaimsPrincipal Principal { get; }
public PermissionValuesCheckContext( public PermissionValuesCheckContext(
[NotNull] List<PermissionDefinition> permissions, [NotNull] List<PermissionDefinition> permissions,
[CanBeNull] ClaimsPrincipal principal) ClaimsPrincipal? principal)
{ {
Check.NotNull(permissions, nameof(permissions)); Check.NotNull(permissions, nameof(permissions));

4
framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs

@ -25,7 +25,7 @@ public static class AbpAuthorizationServiceExtensions
); );
} }
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object? resource, AuthorizationPolicy policy)
{ {
return await authorizationService.AuthorizeAsync( return await authorizationService.AuthorizeAsync(
authorizationService.AsAbpAuthorizationService().CurrentPrincipal, authorizationService.AsAbpAuthorizationService().CurrentPrincipal,
@ -52,7 +52,7 @@ public static class AbpAuthorizationServiceExtensions
); );
} }
public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object resource, string policyName) public static async Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService authorizationService, object? resource, string policyName)
{ {
return await authorizationService.AuthorizeAsync( return await authorizationService.AuthorizeAsync(
authorizationService.AsAbpAuthorizationService().CurrentPrincipal, authorizationService.AsAbpAuthorizationService().CurrentPrincipal,

4
framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AuthorizationOptionsExtensions.cs

@ -7,7 +7,7 @@ namespace Microsoft.AspNetCore.Authorization;
public static class AuthorizationOptionsExtensions public static class AuthorizationOptionsExtensions
{ {
private static readonly PropertyInfo PolicyMapProperty = typeof(AuthorizationOptions) private static readonly PropertyInfo PolicyMapProperty = typeof(AuthorizationOptions)
.GetProperty("PolicyMap", BindingFlags.Instance | BindingFlags.NonPublic); .GetProperty("PolicyMap", BindingFlags.Instance | BindingFlags.NonPublic)!;
/// <summary> /// <summary>
/// Gets all policies. /// Gets all policies.
@ -20,6 +20,6 @@ public static class AuthorizationOptionsExtensions
/// <returns></returns> /// <returns></returns>
public static List<string> GetPoliciesNames(this AuthorizationOptions options) public static List<string> GetPoliciesNames(this AuthorizationOptions options)
{ {
return ((IDictionary<string, AuthorizationPolicy>)PolicyMapProperty.GetValue(options)).Keys.ToList(); return ((IDictionary<string, AuthorizationPolicy>)PolicyMapProperty.GetValue(options)!).Keys.ToList();
} }
} }

2
framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Authorization</AssemblyName> <AssemblyName>Volo.Abp.Authorization</AssemblyName>
<PackageId>Volo.Abp.Authorization</PackageId> <PackageId>Volo.Abp.Authorization</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs

@ -23,7 +23,7 @@ public class AbpAuthorizationPolicyProvider : DefaultAuthorizationPolicyProvider
_options = options.Value; _options = options.Value;
} }
public override async Task<AuthorizationPolicy> GetPolicyAsync(string policyName) public override async Task<AuthorizationPolicy?> GetPolicyAsync(string policyName)
{ {
var policy = await base.GetPolicyAsync(policyName); var policy = await base.GetPolicyAsync(policyName);
if (policy != null) if (policy != null)

4
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/AuthenticatedSimpleStateCheckerSerializerContributor.cs

@ -10,7 +10,7 @@ public class AuthenticatedSimpleStateCheckerSerializerContributor :
{ {
public const string CheckerShortName = "A"; public const string CheckerShortName = "A";
public string SerializeToJson<TState>(ISimpleStateChecker<TState> checker) public string? SerializeToJson<TState>(ISimpleStateChecker<TState> checker)
where TState : IHasSimpleStateCheckers<TState> where TState : IHasSimpleStateCheckers<TState>
{ {
if (checker is not RequireAuthenticatedSimpleStateChecker<TState>) if (checker is not RequireAuthenticatedSimpleStateChecker<TState>)
@ -25,7 +25,7 @@ public class AuthenticatedSimpleStateCheckerSerializerContributor :
return jsonObject.ToJsonString(); return jsonObject.ToJsonString();
} }
public ISimpleStateChecker<TState> Deserialize<TState>(JsonObject jsonObject, TState state) public ISimpleStateChecker<TState>? Deserialize<TState>(JsonObject jsonObject, TState state)
where TState : IHasSimpleStateCheckers<TState> where TState : IHasSimpleStateCheckers<TState>
{ {
if (jsonObject["T"]?.ToString() != CheckerShortName) if (jsonObject["T"]?.ToString() != CheckerShortName)

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IDynamicPermissionDefinitionStore.cs

@ -5,7 +5,7 @@ namespace Volo.Abp.Authorization.Permissions;
public interface IDynamicPermissionDefinitionStore public interface IDynamicPermissionDefinitionStore
{ {
Task<PermissionDefinition> GetOrNullAsync(string name); Task<PermissionDefinition?> GetOrNullAsync(string name);
Task<IReadOnlyList<PermissionDefinition>> GetPermissionsAsync(); Task<IReadOnlyList<PermissionDefinition>> GetPermissionsAsync();

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/IStaticPermissionDefinitionStore.cs

@ -5,7 +5,7 @@ namespace Volo.Abp.Authorization.Permissions;
public interface IStaticPermissionDefinitionStore public interface IStaticPermissionDefinitionStore
{ {
Task<PermissionDefinition> GetOrNullAsync(string name); Task<PermissionDefinition?> GetOrNullAsync(string name);
Task<IReadOnlyList<PermissionDefinition>> GetPermissionsAsync(); Task<IReadOnlyList<PermissionDefinition>> GetPermissionsAsync();

4
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/NullDynamicPermissionDefinitionStore.cs

@ -8,7 +8,7 @@ namespace Volo.Abp.Authorization.Permissions;
public class NullDynamicPermissionDefinitionStore : IDynamicPermissionDefinitionStore, ISingletonDependency public class NullDynamicPermissionDefinitionStore : IDynamicPermissionDefinitionStore, ISingletonDependency
{ {
private readonly static Task<PermissionDefinition> CachedPermissionResult = Task.FromResult((PermissionDefinition)null); private readonly static Task<PermissionDefinition?> CachedPermissionResult = Task.FromResult((PermissionDefinition?)null);
private readonly static Task<IReadOnlyList<PermissionDefinition>> CachedPermissionsResult = private readonly static Task<IReadOnlyList<PermissionDefinition>> CachedPermissionsResult =
Task.FromResult((IReadOnlyList<PermissionDefinition>)Array.Empty<PermissionDefinition>().ToImmutableList()); Task.FromResult((IReadOnlyList<PermissionDefinition>)Array.Empty<PermissionDefinition>().ToImmutableList());
@ -16,7 +16,7 @@ public class NullDynamicPermissionDefinitionStore : IDynamicPermissionDefinition
private readonly static Task<IReadOnlyList<PermissionGroupDefinition>> CachedGroupsResult = private readonly static Task<IReadOnlyList<PermissionGroupDefinition>> CachedGroupsResult =
Task.FromResult((IReadOnlyList<PermissionGroupDefinition>)Array.Empty<PermissionGroupDefinition>().ToImmutableList()); Task.FromResult((IReadOnlyList<PermissionGroupDefinition>)Array.Empty<PermissionGroupDefinition>().ToImmutableList());
public Task<PermissionDefinition> GetOrNullAsync(string name) public Task<PermissionDefinition?> GetOrNullAsync(string name)
{ {
return CachedPermissionResult; return CachedPermissionResult;
} }

4
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs

@ -38,7 +38,7 @@ public class PermissionChecker : IPermissionChecker, ITransientDependency
} }
public virtual async Task<bool> IsGrantedAsync( public virtual async Task<bool> IsGrantedAsync(
ClaimsPrincipal claimsPrincipal, ClaimsPrincipal? claimsPrincipal,
string name) string name)
{ {
Check.NotNull(name, nameof(name)); Check.NotNull(name, nameof(name));
@ -97,7 +97,7 @@ public class PermissionChecker : IPermissionChecker, ITransientDependency
return await IsGrantedAsync(PrincipalAccessor.Principal, names); return await IsGrantedAsync(PrincipalAccessor.Principal, names);
} }
public async Task<MultiplePermissionGrantResult> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string[] names) public async Task<MultiplePermissionGrantResult> IsGrantedAsync(ClaimsPrincipal? claimsPrincipal, string[] names)
{ {
Check.NotNull(names, nameof(names)); Check.NotNull(names, nameof(names));

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionDefinitionManager.cs

@ -30,7 +30,7 @@ public class PermissionDefinitionManager : IPermissionDefinitionManager, ITransi
return permission; return permission;
} }
public virtual async Task<PermissionDefinition> GetOrNullAsync(string name) public virtual async Task<PermissionDefinition?> GetOrNullAsync(string name)
{ {
Check.NotNull(name, nameof(name)); Check.NotNull(name, nameof(name));

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionValueProviderManager.cs

@ -24,7 +24,7 @@ public class PermissionValueProviderManager : IPermissionValueProviderManager, I
() => Options () => Options
.ValueProviders .ValueProviders
.Select(c => serviceProvider.GetRequiredService(c) as IPermissionValueProvider) .Select(c => serviceProvider.GetRequiredService(c) as IPermissionValueProvider)
.ToList(), .ToList()!,
true true
); );
} }

6
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionsSimpleStateCheckerSerializerContributor.cs

@ -12,7 +12,7 @@ public class PermissionsSimpleStateCheckerSerializerContributor :
{ {
public const string CheckerShortName = "P"; public const string CheckerShortName = "P";
public string SerializeToJson<TState>(ISimpleStateChecker<TState> checker) public string? SerializeToJson<TState>(ISimpleStateChecker<TState> checker)
where TState : IHasSimpleStateCheckers<TState> where TState : IHasSimpleStateCheckers<TState>
{ {
if (checker is not RequirePermissionsSimpleStateChecker<TState> permissionsSimpleStateChecker) if (checker is not RequirePermissionsSimpleStateChecker<TState> permissionsSimpleStateChecker)
@ -35,7 +35,7 @@ public class PermissionsSimpleStateCheckerSerializerContributor :
return jsonObject.ToJsonString(); return jsonObject.ToJsonString();
} }
public ISimpleStateChecker<TState> Deserialize<TState>( public ISimpleStateChecker<TState>? Deserialize<TState>(
JsonObject jsonObject, JsonObject jsonObject,
TState state) TState state)
where TState : IHasSimpleStateCheckers<TState> where TState : IHasSimpleStateCheckers<TState>
@ -54,7 +54,7 @@ public class PermissionsSimpleStateCheckerSerializerContributor :
return new RequirePermissionsSimpleStateChecker<TState>( return new RequirePermissionsSimpleStateChecker<TState>(
new RequirePermissionsSimpleBatchStateCheckerModel<TState>( new RequirePermissionsSimpleBatchStateCheckerModel<TState>(
state, state,
nameArray.Select(x => x.ToString()).ToArray(), nameArray.Select(x => x!.ToString()).ToArray(),
(bool?)jsonObject["A"] ?? false (bool?)jsonObject["A"] ?? false
) )
); );

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RequirePermissionsSimpleBatchStateChecker.cs

@ -11,7 +11,7 @@ namespace Volo.Abp.Authorization.Permissions;
public class RequirePermissionsSimpleBatchStateChecker<TState> : SimpleBatchStateCheckerBase<TState> public class RequirePermissionsSimpleBatchStateChecker<TState> : SimpleBatchStateCheckerBase<TState>
where TState : IHasSimpleStateCheckers<TState> where TState : IHasSimpleStateCheckers<TState>
{ {
public static RequirePermissionsSimpleBatchStateChecker<TState> Current => _current.Value; public static RequirePermissionsSimpleBatchStateChecker<TState> Current => _current.Value!;
private static readonly AsyncLocal<RequirePermissionsSimpleBatchStateChecker<TState>> _current = new AsyncLocal<RequirePermissionsSimpleBatchStateChecker<TState>>(); private static readonly AsyncLocal<RequirePermissionsSimpleBatchStateChecker<TState>> _current = new AsyncLocal<RequirePermissionsSimpleBatchStateChecker<TState>>();
private readonly List<RequirePermissionsSimpleBatchStateCheckerModel<TState>> _models; private readonly List<RequirePermissionsSimpleBatchStateCheckerModel<TState>> _models;

4
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/StaticPermissionDefinitionStore.cs

@ -79,7 +79,7 @@ public class StaticPermissionDefinitionStore : IStaticPermissionDefinitionStore,
var providers = Options var providers = Options
.DefinitionProviders .DefinitionProviders
.Select(p => scope.ServiceProvider.GetRequiredService(p) as IPermissionDefinitionProvider) .Select(p => (scope.ServiceProvider.GetRequiredService(p) as IPermissionDefinitionProvider)!)
.ToList(); .ToList();
foreach (var provider in providers) foreach (var provider in providers)
@ -101,7 +101,7 @@ public class StaticPermissionDefinitionStore : IStaticPermissionDefinitionStore,
} }
} }
public Task<PermissionDefinition> GetOrNullAsync(string name) public Task<PermissionDefinition?> GetOrNullAsync(string name)
{ {
return Task.FromResult(PermissionDefinitions.GetOrDefault(name)); return Task.FromResult(PermissionDefinitions.GetOrDefault(name));
} }

2
framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleDtoExtensions.cs

@ -10,7 +10,7 @@ public static class AbpAutoMapperExtensibleDtoExtensions
public static IMappingExpression<TSource, TDestination> MapExtraProperties<TSource, TDestination>( public static IMappingExpression<TSource, TDestination> MapExtraProperties<TSource, TDestination>(
this IMappingExpression<TSource, TDestination> mappingExpression, this IMappingExpression<TSource, TDestination> mappingExpression,
MappingPropertyDefinitionChecks? definitionChecks = null, MappingPropertyDefinitionChecks? definitionChecks = null,
string[] ignoredProperties = null, string[]? ignoredProperties = null,
bool mapToRegularProperties = false) bool mapToRegularProperties = false)
where TDestination : IHasExtraProperties where TDestination : IHasExtraProperties
where TSource : IHasExtraProperties where TSource : IHasExtraProperties

2
framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.AutoMapper</AssemblyName> <AssemblyName>Volo.Abp.AutoMapper</AssemblyName>
<PackageId>Volo.Abp.AutoMapper</PackageId> <PackageId>Volo.Abp.AutoMapper</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

2
framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/MapperAccessor.cs

@ -4,5 +4,5 @@ namespace Volo.Abp.AutoMapper;
internal class MapperAccessor : IMapperAccessor internal class MapperAccessor : IMapperAccessor
{ {
public IMapper Mapper { get; set; } public IMapper Mapper { get; set; } = default!;
} }

2
framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<PackAsTool>true</PackAsTool> <PackAsTool>true</PackAsTool>
<ToolCommandName>abp</ToolCommandName> <ToolCommandName>abp</ToolCommandName>

2
framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Emailing</AssemblyName> <AssemblyName>Volo.Abp.Emailing</AssemblyName>
<PackageId>Volo.Abp.Emailing</PackageId> <PackageId>Volo.Abp.Emailing</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

2
framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs

@ -23,7 +23,7 @@ public class BackgroundEmailSendingJob : AsyncBackgroundJob<BackgroundEmailSendi
} }
else else
{ {
await EmailSender.SendAsync(args.From, args.To, args.Subject, args.Body, args.IsBodyHtml); await EmailSender.SendAsync(args.From!, args.To, args.Subject, args.Body, args.IsBodyHtml);
} }
} }
} }

8
framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJobArgs.cs

@ -5,13 +5,13 @@ namespace Volo.Abp.Emailing;
[Serializable] [Serializable]
public class BackgroundEmailSendingJobArgs public class BackgroundEmailSendingJobArgs
{ {
public string From { get; set; } public string? From { get; set; }
public string To { get; set; } public string To { get; set; } = default!;
public string Subject { get; set; } public string? Subject { get; set; }
public string Body { get; set; } public string? Body { get; set; }
/// <summary> /// <summary>
/// Default: true. /// Default: true.

4
framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs

@ -24,7 +24,7 @@ public abstract class EmailSenderBase : IEmailSender
BackgroundJobManager = backgroundJobManager; BackgroundJobManager = backgroundJobManager;
} }
public virtual async Task SendAsync(string to, string subject, string body, bool isBodyHtml = true) public virtual async Task SendAsync(string to, string? subject, string? body, bool isBodyHtml = true)
{ {
await SendAsync(new MailMessage await SendAsync(new MailMessage
{ {
@ -35,7 +35,7 @@ public abstract class EmailSenderBase : IEmailSender
}); });
} }
public virtual async Task SendAsync(string from, string to, string subject, string body, bool isBodyHtml = true) public virtual async Task SendAsync(string from, string to, string? subject, string? body, bool isBodyHtml = true)
{ {
await SendAsync(new MailMessage(from, to, subject, body) { IsBodyHtml = isBodyHtml }); await SendAsync(new MailMessage(from, to, subject, body) { IsBodyHtml = isBodyHtml });
} }

2
framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderConfiguration.cs

@ -44,6 +44,6 @@ public abstract class EmailSenderConfiguration : IEmailSenderConfiguration
throw new AbpException($"Setting value for '{name}' is null or empty!"); throw new AbpException($"Setting value for '{name}' is null or empty!");
} }
return value; return value!;
} }
} }

8
framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/IEmailSender.cs

@ -13,8 +13,8 @@ public interface IEmailSender
/// </summary> /// </summary>
Task SendAsync( Task SendAsync(
string to, string to,
string subject, string? subject,
string body, string? body,
bool isBodyHtml = true bool isBodyHtml = true
); );
@ -24,8 +24,8 @@ public interface IEmailSender
Task SendAsync( Task SendAsync(
string from, string from,
string to, string to,
string subject, string? subject,
string body, string? body,
bool isBodyHtml = true bool isBodyHtml = true
); );

2
framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/ISmtpEmailSenderConfiguration.cs

@ -30,7 +30,7 @@ public interface ISmtpEmailSenderConfiguration : IEmailSenderConfiguration
/// <summary> /// <summary>
/// Domain name to login to SMTP server. /// Domain name to login to SMTP server.
/// </summary> /// </summary>
Task<string> GetDomainAsync(); Task<string?> GetDomainAsync();
/// <summary> /// <summary>
/// Is SSL enabled? /// Is SSL enabled?

2
framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSenderConfiguration.cs

@ -37,7 +37,7 @@ public class SmtpEmailSenderConfiguration : EmailSenderConfiguration, ISmtpEmail
return GetNotEmptySettingValueAsync(EmailSettingNames.Smtp.Password); return GetNotEmptySettingValueAsync(EmailSettingNames.Smtp.Password);
} }
public Task<string> GetDomainAsync() public Task<string?> GetDomainAsync()
{ {
return SettingProvider.GetOrNullAsync(EmailSettingNames.Smtp.Domain); return SettingProvider.GetOrNullAsync(EmailSettingNames.Smtp.Domain);
} }

6
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs

@ -177,10 +177,10 @@ public class EntityHistoryHelper : IEntityHistoryHelper, ITransientDependency
{ {
propertyChanges.Add(new EntityPropertyChangeInfo propertyChanges.Add(new EntityPropertyChangeInfo
{ {
NewValue = isDeleted ? null : JsonSerializer.Serialize(propertyEntry.CurrentValue).TruncateWithPostfix(EntityPropertyChangeInfo.MaxValueLength), NewValue = isDeleted ? null : JsonSerializer.Serialize(propertyEntry.CurrentValue!).TruncateWithPostfix(EntityPropertyChangeInfo.MaxValueLength),
OriginalValue = isCreated ? null : JsonSerializer.Serialize(propertyEntry.OriginalValue).TruncateWithPostfix(EntityPropertyChangeInfo.MaxValueLength), OriginalValue = isCreated ? null : JsonSerializer.Serialize(propertyEntry.OriginalValue!).TruncateWithPostfix(EntityPropertyChangeInfo.MaxValueLength),
PropertyName = property.Name, PropertyName = property.Name,
PropertyTypeFullName = property.ClrType.GetFirstGenericArgumentIfNullable().FullName PropertyTypeFullName = property.ClrType.GetFirstGenericArgumentIfNullable().FullName!
}); });
} }
} }

2
framework/src/Volo.Abp.Features/Volo.Abp.Features.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Features</AssemblyName> <AssemblyName>Volo.Abp.Features</AssemblyName>
<PackageId>Volo.Abp.Features</PackageId> <PackageId>Volo.Abp.Features</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

4
framework/src/Volo.Abp.Features/Volo/Abp/Features/DefaultValueFeatureValueProvider.cs

@ -14,8 +14,8 @@ public class DefaultValueFeatureValueProvider : FeatureValueProvider //TODO: Dir
} }
public override Task<string> GetOrNullAsync(FeatureDefinition setting) public override Task<string?> GetOrNullAsync(FeatureDefinition setting)
{ {
return Task.FromResult(setting.DefaultValue); return Task.FromResult<string?>(setting.DefaultValue);
} }
} }

2
framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs

@ -18,7 +18,7 @@ public class EditionFeatureValueProvider : FeatureValueProvider
PrincipalAccessor = principalAccessor; PrincipalAccessor = principalAccessor;
} }
public override async Task<string> GetOrNullAsync(FeatureDefinition feature) public override async Task<string?> GetOrNullAsync(FeatureDefinition feature)
{ {
var editionId = PrincipalAccessor.Principal?.FindEditionId(); var editionId = PrincipalAccessor.Principal?.FindEditionId();
if (editionId == null) if (editionId == null)

6
framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs

@ -29,13 +29,13 @@ public class FeatureChecker : FeatureCheckerBase
_providers = new Lazy<List<IFeatureValueProvider>>( _providers = new Lazy<List<IFeatureValueProvider>>(
() => Options () => Options
.ValueProviders .ValueProviders
.Select(type => ServiceProvider.GetRequiredService(type) as IFeatureValueProvider) .Select(type => (ServiceProvider.GetRequiredService(type) as IFeatureValueProvider)!)
.ToList(), .ToList(),
true true
); );
} }
public override async Task<string> GetOrNullAsync(string name) public override async Task<string?> GetOrNullAsync(string name)
{ {
var featureDefinition = await FeatureDefinitionManager.GetAsync(name); var featureDefinition = await FeatureDefinitionManager.GetAsync(name);
var providers = Enumerable var providers = Enumerable
@ -49,7 +49,7 @@ public class FeatureChecker : FeatureCheckerBase
return await GetOrNullValueFromProvidersAsync(providers, featureDefinition); return await GetOrNullValueFromProvidersAsync(providers, featureDefinition);
} }
protected virtual async Task<string> GetOrNullValueFromProvidersAsync( protected virtual async Task<string?> GetOrNullValueFromProvidersAsync(
IEnumerable<IFeatureValueProvider> providers, IEnumerable<IFeatureValueProvider> providers,
FeatureDefinition feature) FeatureDefinition feature)
{ {

4
framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs

@ -6,7 +6,7 @@ namespace Volo.Abp.Features;
public abstract class FeatureCheckerBase : IFeatureChecker, ITransientDependency public abstract class FeatureCheckerBase : IFeatureChecker, ITransientDependency
{ {
public abstract Task<string> GetOrNullAsync(string name); public abstract Task<string?> GetOrNullAsync(string name);
public virtual async Task<bool> IsEnabledAsync(string name) public virtual async Task<bool> IsEnabledAsync(string name)
{ {
@ -18,7 +18,7 @@ public abstract class FeatureCheckerBase : IFeatureChecker, ITransientDependency
try try
{ {
return bool.Parse(value); return bool.Parse(value!);
} }
catch (Exception ex) catch (Exception ex)
{ {

45
framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs

@ -20,17 +20,15 @@ public class FeatureDefinition : ICanCreateChildFeature
get => _displayName; get => _displayName;
set => _displayName = Check.NotNull(value, nameof(value)); set => _displayName = Check.NotNull(value, nameof(value));
} }
private ILocalizableString _displayName; private ILocalizableString _displayName = default!;
[CanBeNull] public ILocalizableString? Description { get; set; }
public ILocalizableString Description { get; set; }
/// <summary> /// <summary>
/// Parent of this feature, if one exists. /// Parent of this feature, if one exists.
/// If set, this feature can be enabled only if the parent is enabled. /// If set, this feature can be enabled only if the parent is enabled.
/// </summary> /// </summary>
[CanBeNull] public FeatureDefinition? Parent { get; private set; }
public FeatureDefinition Parent { get; private set; }
/// <summary> /// <summary>
/// List of child features. /// List of child features.
@ -41,8 +39,7 @@ public class FeatureDefinition : ICanCreateChildFeature
/// <summary> /// <summary>
/// Default value of the feature. /// Default value of the feature.
/// </summary> /// </summary>
[CanBeNull] public string? DefaultValue { get; set; }
public string DefaultValue { get; set; }
/// <summary> /// <summary>
/// Can clients see this feature and it's value. /// Can clients see this feature and it's value.
@ -71,8 +68,7 @@ public class FeatureDefinition : ICanCreateChildFeature
/// Returns the value in the <see cref="Properties"/> dictionary by given <paramref name="name"/>. /// Returns the value in the <see cref="Properties"/> dictionary by given <paramref name="name"/>.
/// Returns null if given <paramref name="name"/> is not present in the <see cref="Properties"/> dictionary. /// Returns null if given <paramref name="name"/> is not present in the <see cref="Properties"/> dictionary.
/// </returns> /// </returns>
[CanBeNull] public object? this[string name] {
public object this[string name] {
get => Properties.GetOrDefault(name); get => Properties.GetOrDefault(name);
set => Properties[name] = value; set => Properties[name] = value;
} }
@ -81,22 +77,21 @@ public class FeatureDefinition : ICanCreateChildFeature
/// Can be used to get/set custom properties for this feature. /// Can be used to get/set custom properties for this feature.
/// </summary> /// </summary>
[NotNull] [NotNull]
public Dictionary<string, object> Properties { get; } public Dictionary<string, object?> Properties { get; }
/// <summary> /// <summary>
/// Input type. /// Input type.
/// This can be used to prepare an input for changing this feature's value. /// This can be used to prepare an input for changing this feature's value.
/// Default: <see cref="ToggleStringValueType"/>. /// Default: <see cref="ToggleStringValueType"/>.
/// </summary> /// </summary>
[CanBeNull] public IStringValueType? ValueType { get; set; }
public IStringValueType ValueType { get; set; }
public FeatureDefinition( public FeatureDefinition(
string name, string name,
string defaultValue = null, string? defaultValue = null,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
ILocalizableString description = null, ILocalizableString? description = null,
IStringValueType valueType = null, IStringValueType? valueType = null,
bool isVisibleToClients = true, bool isVisibleToClients = true,
bool isAvailableToHost = true) bool isAvailableToHost = true)
{ {
@ -108,7 +103,7 @@ public class FeatureDefinition : ICanCreateChildFeature
IsVisibleToClients = isVisibleToClients; IsVisibleToClients = isVisibleToClients;
IsAvailableToHost = isAvailableToHost; IsAvailableToHost = isAvailableToHost;
Properties = new Dictionary<string, object>(); Properties = new Dictionary<string, object?>();
AllowedProviders = new List<string>(); AllowedProviders = new List<string>();
_children = new List<FeatureDefinition>(); _children = new List<FeatureDefinition>();
} }
@ -143,10 +138,10 @@ public class FeatureDefinition : ICanCreateChildFeature
/// <returns>Returns a newly created child feature</returns> /// <returns>Returns a newly created child feature</returns>
public FeatureDefinition CreateChild( public FeatureDefinition CreateChild(
string name, string name,
string defaultValue = null, string? defaultValue = null,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
ILocalizableString description = null, ILocalizableString? description = null,
IStringValueType valueType = null, IStringValueType? valueType = null,
bool isVisibleToClients = true, bool isVisibleToClients = true,
bool isAvailableToHost = true) bool isAvailableToHost = true)
{ {
@ -179,10 +174,10 @@ public class FeatureDefinition : ICanCreateChildFeature
} }
public FeatureDefinition CreateChildFeature(string name, public FeatureDefinition CreateChildFeature(string name,
string defaultValue = null, string? defaultValue = null,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
ILocalizableString description = null, ILocalizableString? description = null,
IStringValueType valueType = null, IStringValueType? valueType = null,
bool isVisibleToClients = true, bool isVisibleToClients = true,
bool isAvailableToHost = true) bool isAvailableToHost = true)
{ {

4
framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinitionContext.cs

@ -12,7 +12,7 @@ public class FeatureDefinitionContext : IFeatureDefinitionContext
Groups = new Dictionary<string, FeatureGroupDefinition>(); Groups = new Dictionary<string, FeatureGroupDefinition>();
} }
public FeatureGroupDefinition AddGroup(string name, ILocalizableString displayName = null) public FeatureGroupDefinition AddGroup(string name, ILocalizableString? displayName = null)
{ {
Check.NotNull(name, nameof(name)); Check.NotNull(name, nameof(name));
@ -24,7 +24,7 @@ public class FeatureDefinitionContext : IFeatureDefinitionContext
return Groups[name] = new FeatureGroupDefinition(name, displayName); return Groups[name] = new FeatureGroupDefinition(name, displayName);
} }
public FeatureGroupDefinition GetGroupOrNull(string name) public FeatureGroupDefinition? GetGroupOrNull(string name)
{ {
Check.NotNull(name, nameof(name)); Check.NotNull(name, nameof(name));

2
framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinitionManager.cs

@ -31,7 +31,7 @@ public class FeatureDefinitionManager : IFeatureDefinitionManager, ISingletonDep
return permission; return permission;
} }
public virtual async Task<FeatureDefinition> GetOrNullAsync(string name) public virtual async Task<FeatureDefinition?> GetOrNullAsync(string name)
{ {
Check.NotNull(name, nameof(name)); Check.NotNull(name, nameof(name));

26
framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureGroupDefinition.cs

@ -12,13 +12,13 @@ public class FeatureGroupDefinition : ICanCreateChildFeature
/// </summary> /// </summary>
public string Name { get; } public string Name { get; }
public Dictionary<string, object> Properties { get; } public Dictionary<string, object?> Properties { get; }
public ILocalizableString DisplayName { public ILocalizableString DisplayName {
get => _displayName; get => _displayName;
set => _displayName = Check.NotNull(value, nameof(value)); set => _displayName = Check.NotNull(value, nameof(value));
} }
private ILocalizableString _displayName; private ILocalizableString _displayName = default!;
public IReadOnlyList<FeatureDefinition> Features => _features.ToImmutableList(); public IReadOnlyList<FeatureDefinition> Features => _features.ToImmutableList();
private readonly List<FeatureDefinition> _features; private readonly List<FeatureDefinition> _features;
@ -31,28 +31,28 @@ public class FeatureGroupDefinition : ICanCreateChildFeature
/// Returns the value in the <see cref="Properties"/> dictionary by given <paramref name="name"/>. /// Returns the value in the <see cref="Properties"/> dictionary by given <paramref name="name"/>.
/// Returns null if given <paramref name="name"/> is not present in the <see cref="Properties"/> dictionary. /// Returns null if given <paramref name="name"/> is not present in the <see cref="Properties"/> dictionary.
/// </returns> /// </returns>
public object this[string name] { public object? this[string name] {
get => Properties.GetOrDefault(name); get => Properties.GetOrDefault(name);
set => Properties[name] = value; set => Properties[name] = value;
} }
protected internal FeatureGroupDefinition( protected internal FeatureGroupDefinition(
string name, string name,
ILocalizableString displayName = null) ILocalizableString? displayName = null)
{ {
Name = name; Name = name;
DisplayName = displayName ?? new FixedLocalizableString(Name); DisplayName = displayName ?? new FixedLocalizableString(Name);
Properties = new Dictionary<string, object>(); Properties = new Dictionary<string, object?>();
_features = new List<FeatureDefinition>(); _features = new List<FeatureDefinition>();
} }
public virtual FeatureDefinition AddFeature( public virtual FeatureDefinition AddFeature(
string name, string name,
string defaultValue = null, string? defaultValue = null,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
ILocalizableString description = null, ILocalizableString? description = null,
IStringValueType valueType = null, IStringValueType? valueType = null,
bool isVisibleToClients = true, bool isVisibleToClients = true,
bool isAvailableToHost = true) bool isAvailableToHost = true)
{ {
@ -72,10 +72,10 @@ public class FeatureGroupDefinition : ICanCreateChildFeature
} }
public FeatureDefinition CreateChildFeature(string name, public FeatureDefinition CreateChildFeature(string name,
string defaultValue = null, string? defaultValue = null,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
ILocalizableString description = null, ILocalizableString? description = null,
IStringValueType valueType = null, IStringValueType? valueType = null,
bool isVisibleToClients = true, bool isVisibleToClients = true,
bool isAvailableToHost = true) bool isAvailableToHost = true)
{ {

2
framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureValueProvider.cs

@ -14,5 +14,5 @@ public abstract class FeatureValueProvider : IFeatureValueProvider, ITransientDe
FeatureStore = featureStore; FeatureStore = featureStore;
} }
public abstract Task<string> GetOrNullAsync(FeatureDefinition feature); public abstract Task<string?> GetOrNullAsync(FeatureDefinition feature);
} }

6
framework/src/Volo.Abp.Features/Volo/Abp/Features/FeaturesSimpleStateCheckerSerializerContributor.cs

@ -11,7 +11,7 @@ public class FeaturesSimpleStateCheckerSerializerContributor :
{ {
public const string CheckerShortName = "F"; public const string CheckerShortName = "F";
public string SerializeToJson<TState>(ISimpleStateChecker<TState> checker) public string? SerializeToJson<TState>(ISimpleStateChecker<TState> checker)
where TState : IHasSimpleStateCheckers<TState> where TState : IHasSimpleStateCheckers<TState>
{ {
if (checker is not RequireFeaturesSimpleStateChecker<TState> featuresSimpleStateChecker) if (checker is not RequireFeaturesSimpleStateChecker<TState> featuresSimpleStateChecker)
@ -34,7 +34,7 @@ public class FeaturesSimpleStateCheckerSerializerContributor :
return jsonObject.ToJsonString(); return jsonObject.ToJsonString();
} }
public ISimpleStateChecker<TState> Deserialize<TState>(JsonObject jsonObject, TState state) public ISimpleStateChecker<TState>? Deserialize<TState>(JsonObject jsonObject, TState state)
where TState : IHasSimpleStateCheckers<TState> where TState : IHasSimpleStateCheckers<TState>
{ {
if (jsonObject["T"]?.ToString() != CheckerShortName) if (jsonObject["T"]?.ToString() != CheckerShortName)
@ -50,7 +50,7 @@ public class FeaturesSimpleStateCheckerSerializerContributor :
return new RequireFeaturesSimpleStateChecker<TState>( return new RequireFeaturesSimpleStateChecker<TState>(
(bool?)jsonObject["A"] ?? false, (bool?)jsonObject["A"] ?? false,
nameArray.Select(x => x.ToString()).ToArray() nameArray.Select(x => x!.ToString()).ToArray()
); );
} }
} }

8
framework/src/Volo.Abp.Features/Volo/Abp/Features/ICanCreateChildFeature.cs

@ -7,10 +7,10 @@ public interface ICanCreateChildFeature
{ {
FeatureDefinition CreateChildFeature( FeatureDefinition CreateChildFeature(
string name, string name,
string defaultValue = null, string? defaultValue = null,
ILocalizableString displayName = null, ILocalizableString? displayName = null,
ILocalizableString description = null, ILocalizableString? description = null,
IStringValueType valueType = null, IStringValueType? valueType = null,
bool isVisibleToClients = true, bool isVisibleToClients = true,
bool isAvailableToHost = true); bool isAvailableToHost = true);
} }

2
framework/src/Volo.Abp.Features/Volo/Abp/Features/IDynamicFeatureDefinitionStore.cs

@ -5,7 +5,7 @@ namespace Volo.Abp.Features;
public interface IDynamicFeatureDefinitionStore public interface IDynamicFeatureDefinitionStore
{ {
Task<FeatureDefinition> GetOrNullAsync(string name); Task<FeatureDefinition?> GetOrNullAsync(string name);
Task<IReadOnlyList<FeatureDefinition>> GetFeaturesAsync(); Task<IReadOnlyList<FeatureDefinition>> GetFeaturesAsync();

2
framework/src/Volo.Abp.Features/Volo/Abp/Features/IFeatureChecker.cs

@ -5,7 +5,7 @@ namespace Volo.Abp.Features;
public interface IFeatureChecker public interface IFeatureChecker
{ {
Task<string> GetOrNullAsync([NotNull] string name); Task<string?> GetOrNullAsync([NotNull] string name);
Task<bool> IsEnabledAsync(string name); Task<bool> IsEnabledAsync(string name);
} }

4
framework/src/Volo.Abp.Features/Volo/Abp/Features/IFeatureDefinitionContext.cs

@ -5,9 +5,9 @@ namespace Volo.Abp.Features;
public interface IFeatureDefinitionContext public interface IFeatureDefinitionContext
{ {
FeatureGroupDefinition AddGroup([NotNull] string name, ILocalizableString displayName = null); FeatureGroupDefinition AddGroup([NotNull] string name, ILocalizableString? displayName = null);
FeatureGroupDefinition GetGroupOrNull(string name); FeatureGroupDefinition? GetGroupOrNull(string name);
void RemoveGroup(string name); void RemoveGroup(string name);
} }

2
framework/src/Volo.Abp.Features/Volo/Abp/Features/IFeatureDefinitionManager.cs

@ -11,7 +11,7 @@ public interface IFeatureDefinitionManager
Task<IReadOnlyList<FeatureDefinition>> GetAllAsync(); Task<IReadOnlyList<FeatureDefinition>> GetAllAsync();
Task<FeatureDefinition> GetOrNullAsync(string name); Task<FeatureDefinition?> GetOrNullAsync(string name);
Task<IReadOnlyList<FeatureGroupDefinition>> GetGroupsAsync(); Task<IReadOnlyList<FeatureGroupDefinition>> GetGroupsAsync();
} }

6
framework/src/Volo.Abp.Features/Volo/Abp/Features/IFeatureStore.cs

@ -5,9 +5,9 @@ namespace Volo.Abp.Features;
public interface IFeatureStore public interface IFeatureStore
{ {
Task<string> GetOrNullAsync( Task<string?> GetOrNullAsync(
[NotNull] string name, [NotNull] string name,
[CanBeNull] string providerName, string? providerName,
[CanBeNull] string providerKey string? providerKey
); );
} }

2
framework/src/Volo.Abp.Features/Volo/Abp/Features/IFeatureValueProvider.cs

@ -7,5 +7,5 @@ public interface IFeatureValueProvider
{ {
string Name { get; } string Name { get; }
Task<string> GetOrNullAsync([NotNull] FeatureDefinition feature); Task<string?> GetOrNullAsync([NotNull] FeatureDefinition feature);
} }

2
framework/src/Volo.Abp.Features/Volo/Abp/Features/IStaticFeatureDefinitionStore.cs

@ -5,7 +5,7 @@ namespace Volo.Abp.Features;
public interface IStaticFeatureDefinitionStore public interface IStaticFeatureDefinitionStore
{ {
Task<FeatureDefinition> GetOrNullAsync(string name); Task<FeatureDefinition?> GetOrNullAsync(string name);
Task<IReadOnlyList<FeatureDefinition>> GetFeaturesAsync(); Task<IReadOnlyList<FeatureDefinition>> GetFeaturesAsync();

2
framework/src/Volo.Abp.Features/Volo/Abp/Features/MethodInvocationFeatureCheckerService.cs

@ -47,7 +47,7 @@ public class MethodInvocationFeatureCheckerService : IMethodInvocationFeatureChe
{ {
attributes = attributes attributes = attributes
.Union( .Union(
methodInfo.DeclaringType methodInfo.DeclaringType!
.GetCustomAttributes(true) .GetCustomAttributes(true)
.OfType<RequiresFeatureAttribute>() .OfType<RequiresFeatureAttribute>()
); );

4
framework/src/Volo.Abp.Features/Volo/Abp/Features/NullDynamicFeatureDefinitionStore.cs

@ -8,7 +8,7 @@ namespace Volo.Abp.Features;
public class NullDynamicFeatureDefinitionStore : IDynamicFeatureDefinitionStore, ISingletonDependency public class NullDynamicFeatureDefinitionStore : IDynamicFeatureDefinitionStore, ISingletonDependency
{ {
private static readonly Task<FeatureDefinition> CachedFeatureResult = Task.FromResult((FeatureDefinition)null); private static readonly Task<FeatureDefinition?> CachedFeatureResult = Task.FromResult((FeatureDefinition?)null);
private static readonly Task<IReadOnlyList<FeatureDefinition>> CachedFeaturesResult = private static readonly Task<IReadOnlyList<FeatureDefinition>> CachedFeaturesResult =
Task.FromResult((IReadOnlyList<FeatureDefinition>)Array.Empty<FeatureDefinition>().ToImmutableList()); Task.FromResult((IReadOnlyList<FeatureDefinition>)Array.Empty<FeatureDefinition>().ToImmutableList());
@ -16,7 +16,7 @@ public class NullDynamicFeatureDefinitionStore : IDynamicFeatureDefinitionStore,
private static readonly Task<IReadOnlyList<FeatureGroupDefinition>> CachedGroupsResult = private static readonly Task<IReadOnlyList<FeatureGroupDefinition>> CachedGroupsResult =
Task.FromResult((IReadOnlyList<FeatureGroupDefinition>)Array.Empty<FeatureGroupDefinition>().ToImmutableList()); Task.FromResult((IReadOnlyList<FeatureGroupDefinition>)Array.Empty<FeatureGroupDefinition>().ToImmutableList());
public Task<FeatureDefinition> GetOrNullAsync(string name) public Task<FeatureDefinition?> GetOrNullAsync(string name)
{ {
return CachedFeatureResult; return CachedFeatureResult;
} }

4
framework/src/Volo.Abp.Features/Volo/Abp/Features/NullFeatureStore.cs

@ -15,8 +15,8 @@ public class NullFeatureStore : IFeatureStore, ISingletonDependency
Logger = NullLogger<NullFeatureStore>.Instance; Logger = NullLogger<NullFeatureStore>.Instance;
} }
public Task<string> GetOrNullAsync(string name, string providerName, string providerKey) public Task<string?> GetOrNullAsync(string name, string? providerName, string? providerKey)
{ {
return Task.FromResult((string)null); return Task.FromResult((string?)null);
} }
} }

4
framework/src/Volo.Abp.Features/Volo/Abp/Features/StaticFeatureDefinitionStore.cs

@ -92,7 +92,7 @@ public class StaticFeatureDefinitionStore: IStaticFeatureDefinitionStore, ISingl
{ {
var providers = Options var providers = Options
.DefinitionProviders .DefinitionProviders
.Select(p => scope.ServiceProvider.GetRequiredService(p) as IFeatureDefinitionProvider) .Select(p => (scope.ServiceProvider.GetRequiredService(p) as IFeatureDefinitionProvider)!)
.ToList(); .ToList();
foreach (var provider in providers) foreach (var provider in providers)
@ -104,7 +104,7 @@ public class StaticFeatureDefinitionStore: IStaticFeatureDefinitionStore, ISingl
return context.Groups; return context.Groups;
} }
public virtual Task<FeatureDefinition> GetOrNullAsync(string name) public virtual Task<FeatureDefinition?> GetOrNullAsync(string name)
{ {
return Task.FromResult(FeatureDefinitions.GetOrDefault(name)); return Task.FromResult(FeatureDefinitions.GetOrDefault(name));
} }

2
framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs

@ -17,7 +17,7 @@ public class TenantFeatureValueProvider : FeatureValueProvider
CurrentTenant = currentTenant; CurrentTenant = currentTenant;
} }
public override async Task<string> GetOrNullAsync(FeatureDefinition feature) public override async Task<string?> GetOrNullAsync(FeatureDefinition feature)
{ {
return await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentTenant.Id?.ToString()); return await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentTenant.Id?.ToString());
} }

2
framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.FluentValidation</AssemblyName> <AssemblyName>Volo.Abp.FluentValidation</AssemblyName>
<PackageId>Volo.Abp.FluentValidation</PackageId> <PackageId>Volo.Abp.FluentValidation</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

6
framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/AbpFluentValidationConventionalRegistrar.cs

@ -24,11 +24,11 @@ public class AbpFluentValidationConventionalRegistrar : DefaultConventionalRegis
{ {
return new List<Type>() return new List<Type>()
{ {
typeof(IValidator<>).MakeGenericType(GetFirstGenericArgumentOrNull(type, 1)) typeof(IValidator<>).MakeGenericType(GetFirstGenericArgumentOrNull(type, 1)!)
}; };
} }
private static Type GetFirstGenericArgumentOrNull(Type type, int depth) private static Type? GetFirstGenericArgumentOrNull(Type type, int depth)
{ {
const int maxFindDepth = 8; const int maxFindDepth = 8;
@ -42,6 +42,6 @@ public class AbpFluentValidationConventionalRegistrar : DefaultConventionalRegis
return type.GetGenericArguments()[0]; return type.GetGenericArguments()[0];
} }
return GetFirstGenericArgumentOrNull(type.BaseType, depth + 1); return GetFirstGenericArgumentOrNull(type.BaseType!, depth + 1);
} }
} }

2
framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/FluentObjectValidationContributor.cs

@ -29,7 +29,7 @@ public class FluentObjectValidationContributor : IObjectValidationContributor, I
var result = await validator.ValidateAsync((IValidationContext)Activator.CreateInstance( var result = await validator.ValidateAsync((IValidationContext)Activator.CreateInstance(
typeof(ValidationContext<>).MakeGenericType(context.ValidatingObject.GetType()), typeof(ValidationContext<>).MakeGenericType(context.ValidatingObject.GetType()),
context.ValidatingObject)); context.ValidatingObject)!);
if (!result.IsValid) if (!result.IsValid)
{ {

2
framework/src/Volo.Abp.Gdpr.Abstractions/Volo.Abp.Gdpr.Abstractions.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>

4
framework/src/Volo.Abp.Gdpr.Abstractions/Volo/Abp/Gdpr/GdprUserDataPreparedEto.cs

@ -7,7 +7,7 @@ public class GdprUserDataPreparedEto
{ {
public Guid RequestId { get; set; } public Guid RequestId { get; set; }
public string Provider { get; set; } public string Provider { get; set; } = default!;
public GdprDataInfo Data { get; set; } public GdprDataInfo Data { get; set; } = default!;
} }

2
framework/src/Volo.Abp.GlobalFeatures/Volo.Abp.GlobalFeatures.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.GlobalFeatures</AssemblyName> <AssemblyName>Volo.Abp.GlobalFeatures</AssemblyName>
<PackageId>Volo.Abp.GlobalFeatures</PackageId> <PackageId>Volo.Abp.GlobalFeatures</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

4
framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnabledException.cs

@ -6,9 +6,9 @@ namespace Volo.Abp.GlobalFeatures;
[Serializable] [Serializable]
public class AbpGlobalFeatureNotEnabledException : AbpException, IHasErrorCode public class AbpGlobalFeatureNotEnabledException : AbpException, IHasErrorCode
{ {
public string Code { get; } public string? Code { get; }
public AbpGlobalFeatureNotEnabledException(string message = null, string code = null, Exception innerException = null) public AbpGlobalFeatureNotEnabledException(string? message = null, string? code = null, Exception? innerException = null)
: base(message, innerException) : base(message, innerException)
{ {
Code = code; Code = code;

2
framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureHelper.cs

@ -5,7 +5,7 @@ namespace Volo.Abp.GlobalFeatures;
public static class GlobalFeatureHelper public static class GlobalFeatureHelper
{ {
public static bool IsGlobalFeatureEnabled(Type type, out RequiresGlobalFeatureAttribute attribute) public static bool IsGlobalFeatureEnabled(Type type, out RequiresGlobalFeatureAttribute? attribute)
{ {
attribute = ReflectionHelper.GetSingleAttributeOrDefault<RequiresGlobalFeatureAttribute>(type); attribute = ReflectionHelper.GetSingleAttributeOrDefault<RequiresGlobalFeatureAttribute>(type);
return attribute == null || GlobalFeatureManager.Instance.IsEnabled(attribute.GetFeatureName()); return attribute == null || GlobalFeatureManager.Instance.IsEnabled(attribute.GetFeatureName());

4
framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureInterceptor.cs

@ -18,8 +18,8 @@ public class GlobalFeatureInterceptor : AbpInterceptor, ITransientDependency
if (!GlobalFeatureHelper.IsGlobalFeatureEnabled(invocation.TargetObject.GetType(), out var attribute)) if (!GlobalFeatureHelper.IsGlobalFeatureEnabled(invocation.TargetObject.GetType(), out var attribute))
{ {
throw new AbpGlobalFeatureNotEnabledException(code: AbpGlobalFeatureErrorCodes.GlobalFeatureIsNotEnabled) throw new AbpGlobalFeatureNotEnabledException(code: AbpGlobalFeatureErrorCodes.GlobalFeatureIsNotEnabled)
.WithData("ServiceName", invocation.TargetObject.GetType().FullName) .WithData("ServiceName", invocation.TargetObject.GetType().FullName!)
.WithData("GlobalFeatureName", attribute.Name); .WithData("GlobalFeatureName", attribute!.Name!);
} }
await invocation.ProceedAsync(); await invocation.ProceedAsync();

6
framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeaturesSimpleStateCheckerSerializerContributor.cs

@ -11,7 +11,7 @@ public class GlobalFeaturesSimpleStateCheckerSerializerContributor :
{ {
public const string CheckerShortName = "G"; public const string CheckerShortName = "G";
public string SerializeToJson<TState>(ISimpleStateChecker<TState> checker) public string? SerializeToJson<TState>(ISimpleStateChecker<TState> checker)
where TState : IHasSimpleStateCheckers<TState> where TState : IHasSimpleStateCheckers<TState>
{ {
if (checker is not RequireGlobalFeaturesSimpleStateChecker<TState> globalFeaturesSimpleStateChecker) if (checker is not RequireGlobalFeaturesSimpleStateChecker<TState> globalFeaturesSimpleStateChecker)
@ -34,7 +34,7 @@ public class GlobalFeaturesSimpleStateCheckerSerializerContributor :
return jsonObject.ToJsonString(); return jsonObject.ToJsonString();
} }
public ISimpleStateChecker<TState> Deserialize<TState>(JsonObject jsonObject, TState state) public ISimpleStateChecker<TState>? Deserialize<TState>(JsonObject jsonObject, TState state)
where TState : IHasSimpleStateCheckers<TState> where TState : IHasSimpleStateCheckers<TState>
{ {
if (jsonObject["T"]?.ToString() != CheckerShortName) if (jsonObject["T"]?.ToString() != CheckerShortName)
@ -50,7 +50,7 @@ public class GlobalFeaturesSimpleStateCheckerSerializerContributor :
return new RequireGlobalFeaturesSimpleStateChecker<TState>( return new RequireGlobalFeaturesSimpleStateChecker<TState>(
(bool?)jsonObject["A"] ?? false, (bool?)jsonObject["A"] ?? false,
nameArray.Select(x => x.ToString()).ToArray() nameArray.Select(x => x!.ToString()).ToArray()
); );
} }
} }

6
framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/RequiresGlobalFeatureAttribute.cs

@ -6,9 +6,9 @@ namespace Volo.Abp.GlobalFeatures;
[AttributeUsage(AttributeTargets.Class)] [AttributeUsage(AttributeTargets.Class)]
public class RequiresGlobalFeatureAttribute : Attribute public class RequiresGlobalFeatureAttribute : Attribute
{ {
public Type Type { get; } public Type? Type { get; }
public string Name { get; } public string? Name { get; }
public RequiresGlobalFeatureAttribute([NotNull] Type type) public RequiresGlobalFeatureAttribute([NotNull] Type type)
{ {
@ -22,6 +22,6 @@ public class RequiresGlobalFeatureAttribute : Attribute
public virtual string GetFeatureName() public virtual string GetFeatureName()
{ {
return Name ?? GlobalFeatureNameAttribute.GetName(Type); return Name ?? GlobalFeatureNameAttribute.GetName(Type!);
} }
} }

2
framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.MailKit</AssemblyName> <AssemblyName>Volo.Abp.MailKit</AssemblyName>
<PackageId>Volo.Abp.MailKit</PackageId> <PackageId>Volo.Abp.MailKit</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

2
framework/src/Volo.Abp.ObjectMapping/Volo.Abp.ObjectMapping.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.ObjectMapping</AssemblyName> <AssemblyName>Volo.Abp.ObjectMapping</AssemblyName>
<PackageId>Volo.Abp.ObjectMapping</PackageId> <PackageId>Volo.Abp.ObjectMapping</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

6
framework/src/Volo.Abp.ObjectMapping/Volo/Abp/ObjectMapping/DefaultObjectMapper.cs

@ -36,7 +36,7 @@ public class DefaultObjectMapper : IObjectMapper, ITransientDependency
{ {
if (source == null) if (source == null)
{ {
return default; return default!;
} }
using (var scope = ServiceProvider.CreateScope()) using (var scope = ServiceProvider.CreateScope())
@ -60,7 +60,7 @@ public class DefaultObjectMapper : IObjectMapper, ITransientDependency
//TODO: Check if TDestination has a proper constructor which takes TSource //TODO: Check if TDestination has a proper constructor which takes TSource
//TODO: Check if TDestination has an empty constructor (in this case, use MapFrom) //TODO: Check if TDestination has an empty constructor (in this case, use MapFrom)
return (TDestination)Activator.CreateInstance(typeof(TDestination), source); return (TDestination)Activator.CreateInstance(typeof(TDestination), source)!;
} }
catch catch
{ {
@ -75,7 +75,7 @@ public class DefaultObjectMapper : IObjectMapper, ITransientDependency
{ {
if (source == null) if (source == null)
{ {
return default; return default!;
} }
using (var scope = ServiceProvider.CreateScope()) using (var scope = ServiceProvider.CreateScope())

8
framework/src/Volo.Abp.ObjectMapping/Volo/Abp/ObjectMapping/ObjectMapperExtensions.cs

@ -5,8 +5,8 @@ namespace Volo.Abp.ObjectMapping;
public static class ObjectMapperExtensions public static class ObjectMapperExtensions
{ {
private static readonly MethodInfo MapToNewObjectMethod; private static readonly MethodInfo MapToNewObjectMethod = default!;
private static readonly MethodInfo MapToExistingObjectMethod; private static readonly MethodInfo MapToExistingObjectMethod = default!;
static ObjectMapperExtensions() static ObjectMapperExtensions()
{ {
@ -32,13 +32,13 @@ public static class ObjectMapperExtensions
{ {
return MapToNewObjectMethod return MapToNewObjectMethod
.MakeGenericMethod(sourceType, destinationType) .MakeGenericMethod(sourceType, destinationType)
.Invoke(objectMapper, new[] { source }); .Invoke(objectMapper, new[] { source })!;
} }
public static object Map(this IObjectMapper objectMapper, Type sourceType, Type destinationType, object source, object destination) public static object Map(this IObjectMapper objectMapper, Type sourceType, Type destinationType, object source, object destination)
{ {
return MapToExistingObjectMethod return MapToExistingObjectMethod
.MakeGenericMethod(sourceType, destinationType) .MakeGenericMethod(sourceType, destinationType)
.Invoke(objectMapper, new[] { source, destination }); .Invoke(objectMapper, new[] { source, destination })!;
} }
} }

4
framework/src/Volo.Abp.Swashbuckle/Microsoft/AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs

@ -9,7 +9,7 @@ public static class AbpSwaggerUIBuilderExtensions
{ {
public static IApplicationBuilder UseAbpSwaggerUI( public static IApplicationBuilder UseAbpSwaggerUI(
this IApplicationBuilder app, this IApplicationBuilder app,
Action<SwaggerUIOptions> setupAction = null) Action<SwaggerUIOptions>? setupAction = null)
{ {
var resolver = app.ApplicationServices.GetService<ISwaggerHtmlResolver>(); var resolver = app.ApplicationServices.GetService<ISwaggerHtmlResolver>();
@ -17,7 +17,7 @@ public static class AbpSwaggerUIBuilderExtensions
{ {
options.InjectJavascript("ui/abp.js"); options.InjectJavascript("ui/abp.js");
options.InjectJavascript("ui/abp.swagger.js"); options.InjectJavascript("ui/abp.swagger.js");
options.IndexStream = () => resolver.Resolver(); options.IndexStream = () => resolver?.Resolver();
setupAction?.Invoke(options); setupAction?.Invoke(options);
}); });

12
framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs

@ -12,7 +12,7 @@ public static class AbpSwaggerGenServiceCollectionExtensions
{ {
public static IServiceCollection AddAbpSwaggerGen( public static IServiceCollection AddAbpSwaggerGen(
this IServiceCollection services, this IServiceCollection services,
Action<SwaggerGenOptions> setupAction = null) Action<SwaggerGenOptions>? setupAction = null)
{ {
return services.AddSwaggerGen( return services.AddSwaggerGen(
options => options =>
@ -34,7 +34,7 @@ public static class AbpSwaggerGenServiceCollectionExtensions
this IServiceCollection services, this IServiceCollection services,
[NotNull] string authority, [NotNull] string authority,
[NotNull] Dictionary<string, string> scopes, [NotNull] Dictionary<string, string> scopes,
Action<SwaggerGenOptions> setupAction = null, Action<SwaggerGenOptions>? setupAction = null,
string authorizationEndpoint = "/connect/authorize", string authorizationEndpoint = "/connect/authorize",
string tokenEndpoint = "/connect/token") string tokenEndpoint = "/connect/token")
{ {
@ -82,10 +82,10 @@ public static class AbpSwaggerGenServiceCollectionExtensions
public static IServiceCollection AddAbpSwaggerGenWithOidc( public static IServiceCollection AddAbpSwaggerGenWithOidc(
this IServiceCollection services, this IServiceCollection services,
[NotNull] string authority, [NotNull] string authority,
string[] scopes = null, string[]? scopes = null,
string[] flows = null, string[]? flows = null,
string discoveryEndpoint = null, string? discoveryEndpoint = null,
Action<SwaggerGenOptions> setupAction = null) Action<SwaggerGenOptions>? setupAction = null)
{ {
var discoveryUrl = discoveryEndpoint != null ? var discoveryUrl = discoveryEndpoint != null ?
new Uri(discoveryEndpoint) : new Uri(discoveryEndpoint) :

2
framework/src/Volo.Abp.Swashbuckle/Volo.Abp.Swashbuckle.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Swashbuckle</AssemblyName> <AssemblyName>Volo.Abp.Swashbuckle</AssemblyName>
<PackageId>Volo.Abp.Swashbuckle</PackageId> <PackageId>Volo.Abp.Swashbuckle</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save