diff --git a/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IDeletionAuditedObject.cs b/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IDeletionAuditedObject.cs index a7be0c29a1..afec5e4e5f 100644 --- a/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IDeletionAuditedObject.cs +++ b/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IDeletionAuditedObject.cs @@ -22,5 +22,5 @@ public interface IDeletionAuditedObject : IDeletionAuditedObject /// /// Reference to the deleter user. /// - TUser Deleter { get; } + TUser? Deleter { get; } } diff --git a/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IMayHaveCreator.cs b/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IMayHaveCreator.cs index 25748f5af9..78989e16d2 100644 --- a/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IMayHaveCreator.cs +++ b/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IMayHaveCreator.cs @@ -8,8 +8,7 @@ public interface IMayHaveCreator /// /// Reference to the creator. /// - [CanBeNull] - TCreator Creator { get; } + TCreator? Creator { get; } } /// diff --git a/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IModificationAuditedObject.cs b/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IModificationAuditedObject.cs index 48f26b6299..a82e1452e8 100644 --- a/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IModificationAuditedObject.cs +++ b/framework/src/Volo.Abp.Auditing.Contracts/Volo/Abp/Auditing/IModificationAuditedObject.cs @@ -22,5 +22,5 @@ public interface IModificationAuditedObject : IModificationAuditedObject /// /// Reference to the last modifier user of this entity. /// - TUser LastModifier { get; } + TUser? LastModifier { get; } } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/LookupExtensionProperty.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/LookupExtensionProperty.razor index 7c32549d51..ecdae979f2 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/LookupExtensionProperty.razor +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/LookupExtensionProperty.razor @@ -9,7 +9,7 @@ net7.0 + enable + Nullable Volo.Abp.Dapper Volo.Abp.Dapper $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/DapperRepository.cs b/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/DapperRepository.cs index b9f061b9aa..fda89ab61d 100644 --- a/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/DapperRepository.cs +++ b/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/DapperRepository.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.Domain.Repositories.Dapper; public class DapperRepository : IDapperRepository, IUnitOfWorkEnabled where TDbContext : IEfCoreDbContext { - public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!; public IDataFilter DataFilter => LazyServiceProvider.LazyGetRequiredService(); @@ -39,9 +39,9 @@ public class DapperRepository : IDapperRepository, IUnitOfWorkEnable public virtual async Task GetDbConnectionAsync() => (await _dbContextProvider.GetDbContextAsync()).Database.GetDbConnection(); [Obsolete("Use GetDbTransactionAsync method.")] - public IDbTransaction DbTransaction => _dbContextProvider.GetDbContext().Database.CurrentTransaction?.GetDbTransaction(); + public IDbTransaction? DbTransaction => _dbContextProvider.GetDbContext().Database.CurrentTransaction?.GetDbTransaction(); - public virtual async Task GetDbTransactionAsync() => (await _dbContextProvider.GetDbContextAsync()).Database.CurrentTransaction?.GetDbTransaction(); + public virtual async Task GetDbTransactionAsync() => (await _dbContextProvider.GetDbContextAsync()).Database.CurrentTransaction?.GetDbTransaction(); protected virtual CancellationToken GetCancellationToken(CancellationToken preferredValue = default) { diff --git a/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/IDapperRepository.cs b/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/IDapperRepository.cs index e5e8fa4c54..5a22e65e00 100644 --- a/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/IDapperRepository.cs +++ b/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/IDapperRepository.cs @@ -12,7 +12,7 @@ public interface IDapperRepository Task GetDbConnectionAsync(); [Obsolete("Use GetDbTransactionAsync method.")] - IDbTransaction DbTransaction { get; } + IDbTransaction? DbTransaction { get; } - Task GetDbTransactionAsync(); + Task GetDbTransactionAsync(); } diff --git a/framework/src/Volo.Abp.Dapr/Volo.Abp.Dapr.csproj b/framework/src/Volo.Abp.Dapr/Volo.Abp.Dapr.csproj index f21af371bb..1b952e34cc 100644 --- a/framework/src/Volo.Abp.Dapr/Volo.Abp.Dapr.csproj +++ b/framework/src/Volo.Abp.Dapr/Volo.Abp.Dapr.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable diff --git a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprClientFactory.cs b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprClientFactory.cs index aa14bbe7f2..43e9dbc953 100644 --- a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprClientFactory.cs +++ b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprClientFactory.cs @@ -24,7 +24,7 @@ public class AbpDaprClientFactory : IAbpDaprClientFactory, ISingletonDependency JsonSerializerOptions = CreateJsonSerializerOptions(systemTextJsonSerializerOptions.Value); } - public virtual DaprClient Create(Action builderAction = null) + public virtual DaprClient Create(Action? builderAction = null) { var builder = new DaprClientBuilder() .UseJsonSerializationOptions(JsonSerializerOptions); @@ -51,9 +51,9 @@ public class AbpDaprClientFactory : IAbpDaprClientFactory, ISingletonDependency } public virtual HttpClient CreateHttpClient( - string appId = null, - string daprEndpoint = null, - string daprApiToken = null) + string? appId = null, + string? daprEndpoint = null, + string? daprApiToken = null) { if(daprEndpoint.IsNullOrWhiteSpace() && !DaprOptions.HttpEndpoint.IsNullOrWhiteSpace()) diff --git a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprModule.cs b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprModule.cs index 4153ae2ec1..e1ca4bb0db 100644 --- a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprModule.cs +++ b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprModule.cs @@ -33,14 +33,14 @@ public class AbpDaprModule : AbpModule var confEnv = configuration["DAPR_API_TOKEN"]; if (!confEnv.IsNullOrWhiteSpace()) { - options.DaprApiToken = confEnv; + options.DaprApiToken = confEnv!; } else { var env = Environment.GetEnvironmentVariable("DAPR_API_TOKEN"); if (!env.IsNullOrWhiteSpace()) { - options.DaprApiToken = env; + options.DaprApiToken = env!; } } } @@ -50,14 +50,14 @@ public class AbpDaprModule : AbpModule var confEnv = configuration["APP_API_TOKEN"]; if (!confEnv.IsNullOrWhiteSpace()) { - options.AppApiToken = confEnv; + options.AppApiToken = confEnv!; } else { var env = Environment.GetEnvironmentVariable("APP_API_TOKEN"); if (!env.IsNullOrWhiteSpace()) { - options.AppApiToken = env; + options.AppApiToken = env!; } } } diff --git a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprOptions.cs b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprOptions.cs index 7ac19ad31c..f436f35147 100644 --- a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprOptions.cs +++ b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprOptions.cs @@ -2,11 +2,11 @@ public class AbpDaprOptions { - public string HttpEndpoint { get; set; } + public string? HttpEndpoint { get; set; } - public string GrpcEndpoint { get; set; } + public string? GrpcEndpoint { get; set; } - public string DaprApiToken { get; set; } + public string? DaprApiToken { get; set; } - public string AppApiToken { get; set; } + public string? AppApiToken { get; set; } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/DaprApiTokenProvider.cs b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/DaprApiTokenProvider.cs index 10dd3913ed..c38f36bf10 100644 --- a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/DaprApiTokenProvider.cs +++ b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/DaprApiTokenProvider.cs @@ -12,12 +12,12 @@ public class DaprApiTokenProvider : IDaprApiTokenProvider, ISingletonDependency Options = options.Value; } - public virtual string GetDaprApiToken() + public virtual string? GetDaprApiToken() { return Options.DaprApiToken; } - public virtual string GetAppApiToken() + public virtual string? GetAppApiToken() { return Options.AppApiToken; } diff --git a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IAbpDaprClientFactory.cs b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IAbpDaprClientFactory.cs index 65c4e76b7e..bbf074af6c 100644 --- a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IAbpDaprClientFactory.cs +++ b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IAbpDaprClientFactory.cs @@ -6,11 +6,11 @@ namespace Volo.Abp.Dapr; public interface IAbpDaprClientFactory { - DaprClient Create(Action builderAction = null); + DaprClient Create(Action? builderAction = null); HttpClient CreateHttpClient( - string appId = null, - string daprEndpoint = null, - string daprApiToken = null + string? appId = null, + string? daprEndpoint = null, + string? daprApiToken = null ); } diff --git a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IDaprApiTokenProvider.cs b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IDaprApiTokenProvider.cs index 60f2195596..5e153ba2ea 100644 --- a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IDaprApiTokenProvider.cs +++ b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/IDaprApiTokenProvider.cs @@ -2,7 +2,7 @@ namespace Volo.Abp.Dapr; public interface IDaprApiTokenProvider { - string GetDaprApiToken(); + string? GetDaprApiToken(); - string GetAppApiToken(); + string? GetAppApiToken(); } diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj index ae01d66fd0..891a4b8a33 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.Ddd.Application.Contracts Volo.Abp.Ddd.Application.Contracts $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/AuditedEntityWithUserDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/AuditedEntityWithUserDto.cs index 992abc68fe..dfdbb10590 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/AuditedEntityWithUserDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/AuditedEntityWithUserDto.cs @@ -12,10 +12,10 @@ namespace Volo.Abp.Application.Dtos; public abstract class AuditedEntityWithUserDto : AuditedEntityDto, IAuditedObject { /// - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } /// - public TUserDto LastModifier { get; set; } + public TUserDto? LastModifier { get; set; } } /// @@ -28,8 +28,8 @@ public abstract class AuditedEntityWithUserDto : AuditedEntityDto, IAu public abstract class AuditedEntityWithUserDto : AuditedEntityDto, IAuditedObject { /// - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } /// - public TUserDto LastModifier { get; set; } + public TUserDto? LastModifier { get; set; } } diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/CreationAuditedEntityWithUserDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/CreationAuditedEntityWithUserDto.cs index e566e8852b..241944bb69 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/CreationAuditedEntityWithUserDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/CreationAuditedEntityWithUserDto.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.Application.Dtos; [Serializable] public abstract class CreationAuditedEntityWithUserDto : CreationAuditedEntityDto, ICreationAuditedObject { - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } } /// @@ -23,5 +23,5 @@ public abstract class CreationAuditedEntityWithUserDto : CreationAudit [Serializable] public abstract class CreationAuditedEntityWithUserDto : CreationAuditedEntityDto, ICreationAuditedObject { - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } } diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/EntityDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/EntityDto.cs index a205549695..656e63b0d5 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/EntityDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/EntityDto.cs @@ -17,7 +17,7 @@ public abstract class EntityDto : EntityDto, IEntityDto /// /// Id of the entity. /// - public TKey Id { get; set; } + public TKey Id { get; set; } = default!; public override string ToString() { diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleAuditedEntityWithUserDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleAuditedEntityWithUserDto.cs index 5f6fd28628..212dcfd807 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleAuditedEntityWithUserDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleAuditedEntityWithUserDto.cs @@ -15,10 +15,10 @@ namespace Volo.Abp.Application.Dtos; public abstract class ExtensibleAuditedEntityWithUserDto : ExtensibleAuditedEntityDto, IAuditedObject { /// - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } /// - public TUserDto LastModifier { get; set; } + public TUserDto? LastModifier { get; set; } protected ExtensibleAuditedEntityWithUserDto() : this(true) @@ -44,10 +44,10 @@ public abstract class ExtensibleAuditedEntityWithUserDto : ExtensibleA IAuditedObject { /// - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } /// - public TUserDto LastModifier { get; set; } + public TUserDto? LastModifier { get; set; } protected ExtensibleAuditedEntityWithUserDto() : this(true) diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleCreationAuditedEntityWithUserDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleCreationAuditedEntityWithUserDto.cs index 3ea1be97ab..21677718cb 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleCreationAuditedEntityWithUserDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleCreationAuditedEntityWithUserDto.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.Application.Dtos; [Serializable] public abstract class ExtensibleCreationAuditedEntityWithUserDto : ExtensibleCreationAuditedEntityDto, ICreationAuditedObject { - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } protected ExtensibleCreationAuditedEntityWithUserDto() : this(true) @@ -39,7 +39,7 @@ public abstract class ExtensibleCreationAuditedEntityWithUserDto : ExtensibleCreationAuditedEntityDto, ICreationAuditedObject { - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } protected ExtensibleCreationAuditedEntityWithUserDto() : this(true) diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleEntityDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleEntityDto.cs index 1af46a3287..9687af0cf7 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleEntityDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleEntityDto.cs @@ -9,7 +9,7 @@ public abstract class ExtensibleEntityDto : ExtensibleObject, IEntityDto /// Id of the entity. /// - public TKey Id { get; set; } + public TKey Id { get; set; } = default!; protected ExtensibleEntityDto() : this(true) diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleFullAuditedEntityWithUserDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleFullAuditedEntityWithUserDto.cs index 018a84cd7a..9793774a47 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleFullAuditedEntityWithUserDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ExtensibleFullAuditedEntityWithUserDto.cs @@ -15,13 +15,13 @@ namespace Volo.Abp.Application.Dtos; public abstract class ExtensibleFullAuditedEntityWithUserDto : ExtensibleFullAuditedEntityDto, IFullAuditedObject { /// - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } /// - public TUserDto LastModifier { get; set; } + public TUserDto? LastModifier { get; set; } /// - public TUserDto Deleter { get; set; } + public TUserDto? Deleter { get; set; } protected ExtensibleFullAuditedEntityWithUserDto() : this(true) @@ -47,13 +47,13 @@ public abstract class ExtensibleFullAuditedEntityWithUserDto : Extensi IFullAuditedObject { /// - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } /// - public TUserDto LastModifier { get; set; } + public TUserDto? LastModifier { get; set; } /// - public TUserDto Deleter { get; set; } + public TUserDto? Deleter { get; set; } protected ExtensibleFullAuditedEntityWithUserDto() : this(true) diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/FullAuditedEntityWithUserDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/FullAuditedEntityWithUserDto.cs index 0575c348b4..c9941d9127 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/FullAuditedEntityWithUserDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/FullAuditedEntityWithUserDto.cs @@ -12,13 +12,13 @@ namespace Volo.Abp.Application.Dtos; public abstract class FullAuditedEntityWithUserDto : FullAuditedEntityDto, IFullAuditedObject { /// - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } /// - public TUserDto LastModifier { get; set; } + public TUserDto? LastModifier { get; set; } /// - public TUserDto Deleter { get; set; } + public TUserDto? Deleter { get; set; } } /// @@ -31,11 +31,11 @@ public abstract class FullAuditedEntityWithUserDto : FullAuditedEntity public abstract class FullAuditedEntityWithUserDto : FullAuditedEntityDto, IFullAuditedObject { /// - public TUserDto Creator { get; set; } + public TUserDto? Creator { get; set; } /// - public TUserDto LastModifier { get; set; } + public TUserDto? LastModifier { get; set; } /// - public TUserDto Deleter { get; set; } + public TUserDto? Deleter { get; set; } } diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ISortedResultRequest.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ISortedResultRequest.cs index 0f0a4fe90f..b27c3bf99d 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ISortedResultRequest.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ISortedResultRequest.cs @@ -16,5 +16,5 @@ public interface ISortedResultRequest /// "Name DESC" /// "Name ASC, Age DESC" /// - string Sorting { get; set; } + string? Sorting { get; set; } } diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/LimitedResultRequestDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/LimitedResultRequestDto.cs index d72f7b0a77..646eb4d45e 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/LimitedResultRequestDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/LimitedResultRequestDto.cs @@ -42,7 +42,7 @@ public class LimitedResultRequestDto : ILimitedResultRequest, IValidatableObject "MaxResultCountExceededExceptionMessage", nameof(MaxResultCount), MaxMaxResultCount, - typeof(LimitedResultRequestDto).FullName, + typeof(LimitedResultRequestDto).FullName!, nameof(MaxMaxResultCount) ], new[] { nameof(MaxResultCount) }); @@ -90,7 +90,7 @@ public class ExtensibleLimitedResultRequestDto : ExtensibleEntityDto, ILimitedRe "MaxResultCountExceededExceptionMessage", nameof(MaxResultCount), MaxMaxResultCount, - typeof(ExtensibleLimitedResultRequestDto).FullName, + typeof(ExtensibleLimitedResultRequestDto).FullName!, nameof(MaxMaxResultCount) ], new[] { nameof(MaxResultCount) }); diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ListResultDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ListResultDto.cs index 361b27faac..56937e7049 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ListResultDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/ListResultDto.cs @@ -13,7 +13,7 @@ public class ListResultDto : IListResult get { return _items ?? (_items = new List()); } set { _items = value; } } - private IReadOnlyList _items; + private IReadOnlyList? _items; /// /// Creates a new object. @@ -42,7 +42,7 @@ public class ExtensibleListResultDto : ExtensibleObject, IListResult get { return _items ?? (_items = new List()); } set { _items = value; } } - private IReadOnlyList _items; + private IReadOnlyList? _items; /// /// Creates a new object. diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/PagedAndSortedResultRequestDto.cs b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/PagedAndSortedResultRequestDto.cs index 229178adbf..8a9b62bb60 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/PagedAndSortedResultRequestDto.cs +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Dtos/PagedAndSortedResultRequestDto.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.Application.Dtos; [Serializable] public class PagedAndSortedResultRequestDto : PagedResultRequestDto, IPagedAndSortedResultRequest { - public virtual string Sorting { get; set; } + public virtual string? Sorting { get; set; } } /// @@ -17,5 +17,5 @@ public class PagedAndSortedResultRequestDto : PagedResultRequestDto, IPagedAndSo [Serializable] public class ExtensiblePagedAndSortedResultRequestDto : ExtensiblePagedResultRequestDto, IPagedAndSortedResultRequest { - public virtual string Sorting { get; set; } + public virtual string? Sorting { get; set; } } diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj b/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj index fc0586ce8e..03351adb7f 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj +++ b/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.Ddd.Application Volo.Abp.Ddd.Application $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs index 6b6ad975d7..b3a2af6663 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs @@ -70,11 +70,11 @@ public abstract class AbstractKeyCrudAppService Repository { get; } - protected virtual string CreatePolicyName { get; set; } + protected virtual string? CreatePolicyName { get; set; } - protected virtual string UpdatePolicyName { get; set; } + protected virtual string? UpdatePolicyName { get; set; } - protected virtual string DeletePolicyName { get; set; } + protected virtual string? DeletePolicyName { get; set; } protected AbstractKeyCrudAppService(IRepository repository) : base(repository) diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs index e56e3ff042..8602792701 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs @@ -40,9 +40,9 @@ public abstract class AbstractKeyReadOnlyAppService ReadOnlyRepository { get; } - protected virtual string GetPolicyName { get; set; } + protected virtual string? GetPolicyName { get; set; } - protected virtual string GetListPolicyName { get; set; } + protected virtual string? GetListPolicyName { get; set; } protected AbstractKeyReadOnlyAppService(IReadOnlyRepository repository) { @@ -107,7 +107,7 @@ public abstract class AbstractKeyReadOnlyAppService LazyServiceProvider.LazyGetRequiredService(); - protected Type ObjectMapperContext { get; set; } + protected Type? ObjectMapperContext { get; set; } protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService(provider => ObjectMapperContext == null ? provider.GetRequiredService() @@ -85,34 +85,34 @@ public abstract class ApplicationService : return _localizer; } } - private IStringLocalizer _localizer; + private IStringLocalizer? _localizer; - protected Type LocalizationResource { + protected Type? LocalizationResource { get => _localizationResource; set { _localizationResource = value; _localizer = null; } } - private Type _localizationResource = typeof(DefaultResource); + private Type? _localizationResource = typeof(DefaultResource); - protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current; + protected IUnitOfWork? CurrentUnitOfWork => UnitOfWorkManager?.Current; - protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName!) ?? NullLogger.Instance); /// /// Checks for given . /// Throws if given policy has not been granted. /// /// The policy name. This method does nothing if given is null or empty. - protected virtual async Task CheckPolicyAsync([CanBeNull] string policyName) + protected virtual async Task CheckPolicyAsync(string? policyName) { if (string.IsNullOrEmpty(policyName)) { return; } - await AuthorizationService.CheckAsync(policyName); + await AuthorizationService.CheckAsync(policyName!); } protected virtual IStringLocalizer CreateLocalizer() diff --git a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj index 2972ef23c1..efc808fdc7 100644 --- a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj +++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.Ddd.Domain.Shared Volo.Abp.Ddd.Domain.Shared $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityEto.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityEto.cs index 8a2983b076..88e71f2e9f 100644 --- a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityEto.cs +++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EntityEto.cs @@ -5,9 +5,9 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed; [Serializable] public class EntityEto : EtoBase { - public string EntityType { get; set; } + public string EntityType { get; set; } = default!; - public string KeysAsString { get; set; } + public string KeysAsString { get; set; } = default!; public EntityEto() { @@ -23,5 +23,5 @@ public class EntityEto : EtoBase public abstract class EntityEto : IEntityEto { - public TKey Id { get; set; } + public TKey Id { get; set; } = default!; } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs index bb9e362ac2..f62ccfd872 100644 --- a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs +++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed; public class EtoMappingDictionary : Dictionary { - public void Add(Type objectMappingContextType = null) + public void Add(Type? objectMappingContextType = null) { this[typeof(TEntity)] = new EtoMappingDictionaryItem(typeof(TEntityEto), objectMappingContextType); } diff --git a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs index a6065e1d5f..c250e6daae 100644 --- a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs +++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs @@ -6,9 +6,9 @@ public class EtoMappingDictionaryItem { public Type EtoType { get; } - public Type ObjectMappingContextType { get; } + public Type? ObjectMappingContextType { get; } - public EtoMappingDictionaryItem(Type etoType, Type objectMappingContextType = null) + public EtoMappingDictionaryItem(Type etoType, Type? objectMappingContextType = null) { EtoType = etoType; ObjectMappingContextType = objectMappingContextType; diff --git a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/IEntityToEtoMapper.cs b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/IEntityToEtoMapper.cs index 6f0ea7a880..67406fd0d4 100644 --- a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/IEntityToEtoMapper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo/Abp/Domain/Entities/Events/Distributed/IEntityToEtoMapper.cs @@ -4,6 +4,5 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed; public interface IEntityToEtoMapper { - [CanBeNull] - object Map(object entityObj); + object? Map(object entityObj); } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj index c15f7c96a8..5130c57f12 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.Ddd.Domain Volo.Abp.Ddd.Domain $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/AbpCommonDbContextRegistrationOptions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/AbpCommonDbContextRegistrationOptions.cs index bc50368645..8342451056 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/AbpCommonDbContextRegistrationOptions.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/AbpCommonDbContextRegistrationOptions.cs @@ -16,13 +16,13 @@ public abstract class AbpCommonDbContextRegistrationOptions : IAbpCommonDbContex public IServiceCollection Services { get; } - public Dictionary ReplacedDbContextTypes { get; } + public Dictionary ReplacedDbContextTypes { get; } public Type DefaultRepositoryDbContextType { get; protected set; } - public Type DefaultRepositoryImplementationType { get; private set; } + public Type? DefaultRepositoryImplementationType { get; private set; } - public Type DefaultRepositoryImplementationTypeWithoutKey { get; private set; } + public Type? DefaultRepositoryImplementationTypeWithoutKey { get; private set; } public bool RegisterDefaultRepositories { get; private set; } @@ -40,7 +40,7 @@ public abstract class AbpCommonDbContextRegistrationOptions : IAbpCommonDbContex Services = services; DefaultRepositoryDbContextType = originalDbContextType; CustomRepositories = new Dictionary(); - ReplacedDbContextTypes = new Dictionary(); + ReplacedDbContextTypes = new Dictionary(); SpecifiedDefaultRepositories = new List(); } @@ -54,7 +54,7 @@ public abstract class AbpCommonDbContextRegistrationOptions : IAbpCommonDbContex return ReplaceDbContext(typeof(TOtherDbContext), typeof(TTargetDbContext), multiTenancySides); } - public IAbpCommonDbContextRegistrationOptionsBuilder ReplaceDbContext(Type otherDbContextType, Type targetDbContextType = null, MultiTenancySides multiTenancySides = MultiTenancySides.Both) + public IAbpCommonDbContextRegistrationOptionsBuilder ReplaceDbContext(Type otherDbContextType, Type? targetDbContextType = null, MultiTenancySides multiTenancySides = MultiTenancySides.Both) { if (!otherDbContextType.IsAssignableFrom(OriginalDbContextType)) { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/IAbpCommonDbContextRegistrationOptionsBuilder.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/IAbpCommonDbContextRegistrationOptionsBuilder.cs index 58a82bf77d..ee580332a8 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/IAbpCommonDbContextRegistrationOptionsBuilder.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/IAbpCommonDbContextRegistrationOptionsBuilder.cs @@ -90,5 +90,5 @@ public interface IAbpCommonDbContextRegistrationOptionsBuilder /// The DbContext type to be replaced /// The target DbContext type (optional, used this DbContext type if not provided) /// MultiTenancy side - IAbpCommonDbContextRegistrationOptionsBuilder ReplaceDbContext(Type otherDbContextType, Type targetDbContextType = null, MultiTenancySides multiTenancySides = MultiTenancySides.Both); + IAbpCommonDbContextRegistrationOptionsBuilder ReplaceDbContext(Type otherDbContextType, Type? targetDbContextType = null, MultiTenancySides multiTenancySides = MultiTenancySides.Both); } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/MultiTenantDbContextType.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/MultiTenantDbContextType.cs index ff0d74608a..b015b9204a 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/MultiTenantDbContextType.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/DependencyInjection/MultiTenantDbContextType.cs @@ -15,7 +15,7 @@ public class MultiTenantDbContextType MultiTenancySide = multiTenancySide; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { var other = obj as MultiTenantDbContextType; diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs index ebb573579b..f38c21d2fe 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs @@ -12,10 +12,10 @@ public abstract class AuditedAggregateRootWithUser : AuditedAggregateRoot where TUser : IEntity { /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } /// - public virtual TUser LastModifier { get; set; } + public virtual TUser? LastModifier { get; set; } } /// @@ -28,10 +28,10 @@ public abstract class AuditedAggregateRootWithUser : AuditedAggrega where TUser : IEntity { /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } /// - public virtual TUser LastModifier { get; set; } + public virtual TUser? LastModifier { get; set; } protected AuditedAggregateRootWithUser() { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs index 99b9b66303..3f8598d348 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs @@ -12,10 +12,10 @@ public abstract class AuditedEntityWithUser : AuditedEntity, IAuditedObje where TUser : IEntity { /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } /// - public virtual TUser LastModifier { get; set; } + public virtual TUser? LastModifier { get; set; } } /// @@ -28,10 +28,10 @@ public abstract class AuditedEntityWithUser : AuditedEntity, where TUser : IEntity { /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } /// - public virtual TUser LastModifier { get; set; } + public virtual TUser? LastModifier { get; set; } protected AuditedEntityWithUser() { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedAggregateRootWithUser.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedAggregateRootWithUser.cs index 73da9d2026..4407a93de8 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedAggregateRootWithUser.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedAggregateRootWithUser.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.Domain.Entities.Auditing; public abstract class CreationAuditedAggregateRootWithUser : CreationAuditedAggregateRoot, ICreationAuditedObject { /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } } /// @@ -23,7 +23,7 @@ public abstract class CreationAuditedAggregateRootWithUser : CreationAudi public abstract class CreationAuditedAggregateRootWithUser : CreationAuditedAggregateRoot, ICreationAuditedObject { /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } protected CreationAuditedAggregateRootWithUser() { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedEntityWithUser.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedEntityWithUser.cs index 203967fb89..635bb06183 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedEntityWithUser.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedEntityWithUser.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.Domain.Entities.Auditing; public abstract class CreationAuditedEntityWithUser : CreationAuditedEntity, ICreationAuditedObject { /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } } /// @@ -23,7 +23,7 @@ public abstract class CreationAuditedEntityWithUser : CreationAuditedEnti public abstract class CreationAuditedEntityWithUser : CreationAuditedEntity, ICreationAuditedObject { /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } protected CreationAuditedEntityWithUser() { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRootWithUser.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRootWithUser.cs index 918270088e..af8f196f00 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRootWithUser.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRootWithUser.cs @@ -12,13 +12,13 @@ public abstract class FullAuditedAggregateRootWithUser : FullAuditedAggre where TUser : IEntity { /// - public virtual TUser Deleter { get; set; } + public virtual TUser? Deleter { get; set; } /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } /// - public virtual TUser LastModifier { get; set; } + public virtual TUser? LastModifier { get; set; } } /// @@ -31,13 +31,13 @@ public abstract class FullAuditedAggregateRootWithUser : FullAudite where TUser : IEntity { /// - public virtual TUser Deleter { get; set; } + public virtual TUser? Deleter { get; set; } /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } /// - public virtual TUser LastModifier { get; set; } + public virtual TUser? LastModifier { get; set; } protected FullAuditedAggregateRootWithUser() { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs index 1f4886f4c0..834b106d95 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs @@ -12,13 +12,13 @@ public abstract class FullAuditedEntityWithUser : FullAuditedEntity, IFul where TUser : IEntity { /// - public virtual TUser Deleter { get; set; } + public virtual TUser? Deleter { get; set; } /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } /// - public virtual TUser LastModifier { get; set; } + public virtual TUser? LastModifier { get; set; } } /// @@ -31,13 +31,13 @@ public abstract class FullAuditedEntityWithUser : FullAuditedEntity where TUser : IEntity { /// - public virtual TUser Deleter { get; set; } + public virtual TUser? Deleter { get; set; } /// - public virtual TUser Creator { get; protected set; } + public virtual TUser? Creator { get; protected set; } /// - public virtual TUser LastModifier { get; set; } + public virtual TUser? LastModifier { get; set; } protected FullAuditedEntityWithUser() { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheBase.cs index 7e5b17b687..2cb2b2c32b 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheBase.cs @@ -27,23 +27,23 @@ public abstract class EntityCacheBase : UnitOfWorkManager = unitOfWorkManager; } - public virtual async Task FindAsync(TKey id) + public virtual async Task FindAsync(TKey id) { return await Cache.GetOrAddAsync( id, - async () => MapToCacheItem(await Repository.FindAsync(id)) + async () => MapToCacheItem(await Repository.FindAsync(id))! ); } public virtual async Task GetAsync(TKey id) { - return await Cache.GetOrAddAsync( + return (await Cache.GetOrAddAsync( id, - async () => MapToCacheItem(await Repository.GetAsync(id)) - ); + async () => MapToCacheItem(await Repository.GetAsync(id))! + ))!; } - protected abstract TEntityCacheItem MapToCacheItem(TEntity entity); + protected abstract TEntityCacheItem? MapToCacheItem(TEntity? entity); public async Task HandleEventAsync(EntityChangedEventData eventData) { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheServiceCollectionExtensions.cs index bf7ceac45c..c208c7b107 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheServiceCollectionExtensions.cs @@ -13,7 +13,7 @@ public static class EntityCacheServiceCollectionExtensions { public static IServiceCollection AddEntityCache( this IServiceCollection services, - [CanBeNull] DistributedCacheEntryOptions cacheOptions = null) + DistributedCacheEntryOptions? cacheOptions = null) where TEntity : Entity { services @@ -39,7 +39,7 @@ public static class EntityCacheServiceCollectionExtensions public static IServiceCollection AddEntityCache( this IServiceCollection services, - [CanBeNull] DistributedCacheEntryOptions cacheOptions = null) + DistributedCacheEntryOptions? cacheOptions = null) where TEntity : Entity where TEntityCacheItem : class { @@ -61,7 +61,7 @@ public static class EntityCacheServiceCollectionExtensions public static IServiceCollection AddEntityCache( this IServiceCollection services, - [CanBeNull] DistributedCacheEntryOptions cacheOptions = null) + DistributedCacheEntryOptions? cacheOptions = null) where TEntity : Entity where TEntityCacheItem : class { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheWithObjectMapper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheWithObjectMapper.cs index 727df63ea7..a37ad49b1e 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheWithObjectMapper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheWithObjectMapper.cs @@ -23,7 +23,7 @@ public class EntityCacheWithObjectMapper : ObjectMapper = objectMapper; } - protected override TEntityCacheItem MapToCacheItem(TEntity entity) + protected override TEntityCacheItem? MapToCacheItem(TEntity? entity) { if (entity == null) { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheWithoutCacheItem.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheWithoutCacheItem.cs index c81f3e5e9e..0f300a7f28 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheWithoutCacheItem.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/EntityCacheWithoutCacheItem.cs @@ -16,7 +16,7 @@ public class EntityCacheWithoutCacheItem : { } - protected override TEntity MapToCacheItem(TEntity entity) + protected override TEntity? MapToCacheItem(TEntity? entity) { return entity; } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/IEntityCache.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/IEntityCache.cs index 84f4486c65..bd8ba80a63 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/IEntityCache.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Caching/IEntityCache.cs @@ -10,8 +10,7 @@ public interface IEntityCache /// Gets the entity with given , /// or returns null if the entity was not found. /// - [ItemCanBeNull] - Task FindAsync(TKey id); + Task FindAsync(TKey id); /// /// Gets the entity with given , diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs index 54ebd01d1e..9e52d1abfd 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs @@ -18,7 +18,7 @@ public abstract class Entity : IEntity return $"[ENTITY: {GetType().Name}] Keys = {GetKeys().JoinAsString(", ")}"; } - public abstract object[] GetKeys(); + public abstract object?[] GetKeys(); public bool EntityEquals(IEntity other) { @@ -31,7 +31,7 @@ public abstract class Entity : IEntity public abstract class Entity : Entity, IEntity { /// - public virtual TKey Id { get; protected set; } + public virtual TKey Id { get; protected set; } = default!; protected Entity() { @@ -43,9 +43,9 @@ public abstract class Entity : Entity, IEntity Id = id; } - public override object[] GetKeys() + public override object?[] GetKeys() { - return new object[] { Id }; + return new object?[] { Id }; } /// diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs index f7a4f27e5f..584807fac5 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs @@ -25,7 +25,7 @@ public static class EntityHelper return typeof(IMultiTenant).IsAssignableFrom(type); } - public static bool EntityEquals(IEntity entity1, IEntity entity2) + public static bool EntityEquals(IEntity? entity1, IEntity? entity2) { if (entity1 == null || entity2 == null) { @@ -131,7 +131,7 @@ public static class EntityHelper return IsValueObjectPredicate(type); } - public static bool IsValueObject(object obj) + public static bool IsValueObject(object? obj) { return obj != null && IsValueObject(obj.GetType()); } @@ -161,7 +161,7 @@ public static class EntityHelper public static bool HasDefaultId(IEntity entity) { - if (EqualityComparer.Default.Equals(entity.Id, default)) + if (EqualityComparer.Default.Equals(entity.Id, default!)) { return true; } @@ -180,7 +180,7 @@ public static class EntityHelper return false; } - private static bool IsDefaultKeyValue(object value) + private static bool IsDefaultKeyValue(object? value) { if (value == null) { @@ -222,8 +222,7 @@ public static class EntityHelper /// Tries to find the primary key type of the given entity type. /// May return null if given type does not implement /// - [CanBeNull] - public static Type FindPrimaryKeyType() + public static Type? FindPrimaryKeyType() where TEntity : IEntity { return FindPrimaryKeyType(typeof(TEntity)); @@ -233,8 +232,7 @@ public static class EntityHelper /// Tries to find the primary key type of the given entity type. /// May return null if given type does not implement /// - [CanBeNull] - public static Type FindPrimaryKeyType([NotNull] Type entityType) + public static Type? FindPrimaryKeyType([NotNull] Type entityType) { if (!typeof(IEntity).IsAssignableFrom(entityType)) { @@ -260,7 +258,7 @@ public static class EntityHelper var lambdaParam = Expression.Parameter(typeof(TEntity)); var leftExpression = Expression.PropertyOrField(lambdaParam, "Id"); var idValue = Convert.ChangeType(id, typeof(TKey)); - Expression> closure = () => idValue; + Expression> closure = () => idValue; var rightExpression = Expression.Convert(closure.Body, leftExpression.Type); var lambdaBody = Expression.Equal(leftExpression, rightExpression); return Expression.Lambda>(lambdaBody, lambdaParam); diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntitySynchronizer.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntitySynchronizer.cs index b971acc25f..5640c427c2 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntitySynchronizer.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntitySynchronizer.cs @@ -22,7 +22,7 @@ public abstract class EntitySynchronizer : Repository = repository; } - protected override Task FindLocalEntityAsync(TSourceEntityEto eto) + protected override Task FindLocalEntityAsync(TSourceEntityEto eto) { return Repository.FindAsync(eto.Id); } @@ -154,10 +154,9 @@ public abstract class EntitySynchronizer : return true; } - [ItemCanBeNull] - protected abstract Task FindLocalEntityAsync(TSourceEntityEto eto); + protected abstract Task FindLocalEntityAsync(TSourceEntityEto eto); - protected virtual Task IsEtoNewerAsync(TSourceEntityEto eto, [CanBeNull] TEntity localEntity) + protected virtual Task IsEtoNewerAsync(TSourceEntityEto eto, TEntity? localEntity) { if (localEntity is IHasEntityVersion versionedLocalEntity && eto is IHasEntityVersion versionedEto) { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs index b9d5911375..cab3fe4614 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs @@ -21,7 +21,7 @@ public class EntityToEtoMapper : IEntityToEtoMapper, ITransientDependency Options = options.Value; } - public object Map(object entityObj) + public object? Map(object entityObj) { Check.NotNull(entityObj, nameof(entityObj)); @@ -36,7 +36,7 @@ public class EntityToEtoMapper : IEntityToEtoMapper, ITransientDependency if (etoMappingItem == null) { var keys = entity.GetKeys().JoinAsString(","); - return new EntityEto(entityType.FullName, keys); + return new EntityEto(entityType.FullName!, keys); } using (var scope = HybridServiceScopeFactory.CreateScope()) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs index 20556f16ff..44eb5c058a 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs @@ -133,7 +133,7 @@ public class EntityChangeEventHelper : IEntityChangeEventHelper, ITransientDepen { var entityType = ProxyHelper.UnProxy(entityOrEto).GetType(); var eventType = genericEventType.MakeGenericType(entityType); - var eventData = Activator.CreateInstance(eventType, entityOrEto); + var eventData = Activator.CreateInstance(eventType, entityOrEto)!; var currentUow = UnitOfWorkManager.Current; if (currentUow == null) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityEventData.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityEventData.cs index c2845da60e..b295f22f4e 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityEventData.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityEventData.cs @@ -27,7 +27,7 @@ public class EntityEventData : IEventDataWithInheritableGenericArgument public virtual object[] GetConstructorArgs() { - return new object[] { Entity }; + return new object[] { Entity! }; } public virtual bool IsMultiTenant(out Guid? tenantId) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs index 7f4d425df2..1df1b75696 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs @@ -10,7 +10,7 @@ public interface IEntity /// Returns an array of ordered keys for this entity. /// /// - object[] GetKeys(); + object?[] GetKeys(); } /// diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs index 8a87f9c391..0d86045eea 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs @@ -20,9 +20,9 @@ public abstract class BasicRepositoryBase : IUnitOfWorkEnabled where TEntity : class, IEntity { - public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!; - public IServiceProvider ServiceProvider { get; set; } + public IServiceProvider ServiceProvider { get; set; } = default!; public IDataFilter DataFilter => LazyServiceProvider.LazyGetRequiredService(); @@ -123,7 +123,7 @@ public abstract class BasicRepositoryBase : BasicRepositoryBase FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default); + public abstract Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default); public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default) { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs index 6d447552f9..0736685709 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IReadOnlyBasicRepository.cs @@ -51,5 +51,5 @@ public interface IReadOnlyBasicRepository : IReadOnlyBasicReposit /// Set true to include all children of this entity /// A to observe while waiting for the task to complete. /// Entity or null - Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default); + Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default); } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs index da915626a8..3c7ae81875 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs @@ -28,7 +28,7 @@ public interface IRepository : IReadOnlyRepository, IBasicRepo /// A condition to find the entity /// Set true to include all children of this entity /// A to observe while waiting for the task to complete. - Task FindAsync( + Task FindAsync( [NotNull] Expression> predicate, bool includeDetails = true, CancellationToken cancellationToken = default diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryAsyncExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryAsyncExtensions.cs index 304f9ea0bd..2115d00200 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryAsyncExtensions.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryAsyncExtensions.cs @@ -120,7 +120,7 @@ public static class RepositoryAsyncExtensions return await repository.AsyncExecuter.FirstAsync(queryable, predicate, cancellationToken); } - public static async Task FirstOrDefaultAsync( + public static async Task FirstOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity @@ -129,7 +129,7 @@ public static class RepositoryAsyncExtensions return await repository.AsyncExecuter.FirstOrDefaultAsync(queryable, cancellationToken); } - public static async Task FirstOrDefaultAsync( + public static async Task FirstOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) @@ -162,7 +162,7 @@ public static class RepositoryAsyncExtensions return await repository.AsyncExecuter.LastAsync(queryable, predicate, cancellationToken); } - public static async Task LastOrDefaultAsync( + public static async Task LastOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity @@ -171,7 +171,7 @@ public static class RepositoryAsyncExtensions return await repository.AsyncExecuter.LastOrDefaultAsync(queryable, cancellationToken); } - public static async Task LastOrDefaultAsync( + public static async Task LastOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) @@ -204,7 +204,7 @@ public static class RepositoryAsyncExtensions return await repository.AsyncExecuter.SingleAsync(queryable, predicate, cancellationToken); } - public static async Task SingleOrDefaultAsync( + public static async Task SingleOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, CancellationToken cancellationToken = default) where T : class, IEntity @@ -213,7 +213,7 @@ public static class RepositoryAsyncExtensions return await repository.AsyncExecuter.SingleOrDefaultAsync(queryable, cancellationToken); } - public static async Task SingleOrDefaultAsync( + public static async Task SingleOrDefaultAsync( [NotNull] this IReadOnlyRepository repository, [NotNull] Expression> predicate, CancellationToken cancellationToken = default) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs index d843584fc4..eb2457f8c8 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs @@ -41,7 +41,7 @@ public abstract class RepositoryBase : BasicRepositoryBase, IR public abstract Task> GetQueryableAsync(); - public abstract Task FindAsync( + public abstract Task FindAsync( Expression> predicate, bool includeDetails = true, CancellationToken cancellationToken = default); @@ -76,13 +76,13 @@ public abstract class RepositoryBase : BasicRepositoryBase, IR { if (typeof(ISoftDelete).IsAssignableFrom(typeof(TOtherEntity))) { - query = (TQueryable)query.WhereIf(DataFilter.IsEnabled(), e => ((ISoftDelete)e).IsDeleted == false); + query = (TQueryable)query.WhereIf(DataFilter.IsEnabled(), e => ((ISoftDelete)e!).IsDeleted == false); } if (typeof(IMultiTenant).IsAssignableFrom(typeof(TOtherEntity))) { var tenantId = CurrentTenant.Id; - query = (TQueryable)query.WhereIf(DataFilter.IsEnabled(), e => ((IMultiTenant)e).TenantId == tenantId); + query = (TQueryable)query.WhereIf(DataFilter.IsEnabled(), e => ((IMultiTenant)e!).TenantId == tenantId); } return query; @@ -94,7 +94,7 @@ public abstract class RepositoryBase : RepositoryBase, I { public abstract Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default); - public abstract Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default); + public abstract Task FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default); public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default) { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs index 379203f46a..cbebf62196 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs @@ -54,7 +54,7 @@ public static class RepositoryExtensions ) where TEntity : class, IEntity { - if (!await repository.AnyAsync(x => x.Id.Equals(id), cancellationToken)) + if (!await repository.AnyAsync(x => x.Id!.Equals(id), cancellationToken)) { throw new EntityNotFoundException(typeof(TEntity), id); } @@ -87,7 +87,7 @@ public static class RepositoryExtensions { using (var uow = uowManager.Begin()) { - await HardDeleteWithUnitOfWorkAsync(repository, predicate, autoSave, cancellationToken, uowManager.Current); + await HardDeleteWithUnitOfWorkAsync(repository, predicate, autoSave, cancellationToken, uowManager.Current!); await uow.CompleteAsync(cancellationToken); } } @@ -111,7 +111,7 @@ public static class RepositoryExtensions { using (var uow = uowManager.Begin()) { - await HardDeleteWithUnitOfWorkAsync(repository, entities, autoSave, cancellationToken, uowManager.Current); + await HardDeleteWithUnitOfWorkAsync(repository, entities, autoSave, cancellationToken, uowManager.Current!); await uow.CompleteAsync(cancellationToken); } } @@ -135,7 +135,7 @@ public static class RepositoryExtensions { using (var uow = uowManager.Begin()) { - await HardDeleteWithUnitOfWorkAsync(repository, entity, autoSave, cancellationToken, uowManager.Current); + await HardDeleteWithUnitOfWorkAsync(repository, entity, autoSave, cancellationToken, uowManager.Current!); await uow.CompleteAsync(cancellationToken); } } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs index 320aed8312..d162f2ffea 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryRegistrarBase.cs @@ -75,12 +75,12 @@ public abstract class RepositoryRegistrarBase if (primaryKeyType == null) { return Options.SpecifiedDefaultRepositoryTypes - ? Options.DefaultRepositoryImplementationTypeWithoutKey.MakeGenericType(entityType) + ? Options.DefaultRepositoryImplementationTypeWithoutKey!.MakeGenericType(entityType) : GetRepositoryType(Options.DefaultRepositoryDbContextType, entityType); } return Options.SpecifiedDefaultRepositoryTypes - ? Options.DefaultRepositoryImplementationType.MakeGenericType(entityType, primaryKeyType) + ? Options.DefaultRepositoryImplementationType!.MakeGenericType(entityType, primaryKeyType) : GetRepositoryType(Options.DefaultRepositoryDbContextType, entityType, primaryKeyType); } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs index 32cf42409c..b36b32eafd 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Services/DomainService.cs @@ -11,10 +11,10 @@ namespace Volo.Abp.Domain.Services; public abstract class DomainService : IDomainService { - public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!; [Obsolete("Use LazyServiceProvider instead.")] - public IServiceProvider ServiceProvider { get; set; } + public IServiceProvider ServiceProvider { get; set; } = default!; protected IClock Clock => LazyServiceProvider.LazyGetRequiredService(); @@ -26,5 +26,5 @@ public abstract class DomainService : IDomainService protected IAsyncQueryableExecuter AsyncExecuter => LazyServiceProvider.LazyGetRequiredService(); - protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName!) ?? NullLogger.Instance); } diff --git a/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo.Abp.DistributedLocking.Abstractions.csproj b/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo.Abp.DistributedLocking.Abstractions.csproj index 7e01d295e7..e53f5b718c 100644 --- a/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo.Abp.DistributedLocking.Abstractions.csproj +++ b/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo.Abp.DistributedLocking.Abstractions.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.DistributedLocking.Abstractions Volo.Abp.DistributedLocking.Abstractions $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/IAbpDistributedLock.cs b/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/IAbpDistributedLock.cs index 754ae807f8..1d1b5e01db 100644 --- a/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/IAbpDistributedLock.cs +++ b/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/IAbpDistributedLock.cs @@ -16,8 +16,7 @@ public interface IAbpDistributedLock /// The name of the lock /// How long to wait before giving up on the acquisition attempt. Defaults to 0 /// Cancellation token - [ItemCanBeNull] - Task TryAcquireAsync( + Task TryAcquireAsync( [NotNull] string name, TimeSpan timeout = default, CancellationToken cancellationToken = default diff --git a/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/LocalAbpDistributedLock.cs b/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/LocalAbpDistributedLock.cs index 490f024d36..58d67e1caf 100644 --- a/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/LocalAbpDistributedLock.cs +++ b/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/LocalAbpDistributedLock.cs @@ -22,7 +22,7 @@ public class LocalAbpDistributedLock : IAbpDistributedLock, ISingletonDependency } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public async Task TryAcquireAsync( + public async Task TryAcquireAsync( string name, TimeSpan timeout = default, CancellationToken cancellationToken = default) diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj index 79d39eedf0..a0ddaac22e 100644 --- a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj +++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/AbpDistributedLockDaprOptions.cs b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/AbpDistributedLockDaprOptions.cs index a51ed8ede7..b4572441d3 100644 --- a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/AbpDistributedLockDaprOptions.cs +++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/AbpDistributedLockDaprOptions.cs @@ -4,7 +4,7 @@ namespace Volo.Abp.DistributedLocking.Dapr; public class AbpDistributedLockDaprOptions { - public string StoreName { get; set; } + public string StoreName { get; set; } = default!; public string? Owner { get; set; } diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/DaprAbpDistributedLock.cs b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/DaprAbpDistributedLock.cs index 974c6461a6..100fece989 100644 --- a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/DaprAbpDistributedLock.cs +++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/DaprAbpDistributedLock.cs @@ -24,7 +24,7 @@ public class DaprAbpDistributedLock : IAbpDistributedLock, ITransientDependency DistributedLockDaprOptions = distributedLockDaprOptions.Value; } - public async Task TryAcquireAsync( + public async Task TryAcquireAsync( string name, TimeSpan timeout = default, CancellationToken cancellationToken = default) diff --git a/framework/src/Volo.Abp.DistributedLocking/Volo.Abp.DistributedLocking.csproj b/framework/src/Volo.Abp.DistributedLocking/Volo.Abp.DistributedLocking.csproj index ae9f960917..8abd0873bd 100644 --- a/framework/src/Volo.Abp.DistributedLocking/Volo.Abp.DistributedLocking.csproj +++ b/framework/src/Volo.Abp.DistributedLocking/Volo.Abp.DistributedLocking.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.DistributedLocking Volo.Abp.DistributedLocking $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.DistributedLocking/Volo/Abp/DistributedLocking/MedallionAbpDistributedLock.cs b/framework/src/Volo.Abp.DistributedLocking/Volo/Abp/DistributedLocking/MedallionAbpDistributedLock.cs index 0defc5a75f..2d9d07b45a 100644 --- a/framework/src/Volo.Abp.DistributedLocking/Volo/Abp/DistributedLocking/MedallionAbpDistributedLock.cs +++ b/framework/src/Volo.Abp.DistributedLocking/Volo/Abp/DistributedLocking/MedallionAbpDistributedLock.cs @@ -25,7 +25,7 @@ public class MedallionAbpDistributedLock : IAbpDistributedLock, ITransientDepend DistributedLockKeyNormalizer = distributedLockKeyNormalizer; } - public async Task TryAcquireAsync( + public async Task TryAcquireAsync( string name, TimeSpan timeout = default, CancellationToken cancellationToken = default) diff --git a/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/AsyncQueryableExecuter.cs b/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/AsyncQueryableExecuter.cs index 108d3bb595..a6b9fb7949 100644 --- a/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/AsyncQueryableExecuter.cs +++ b/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/AsyncQueryableExecuter.cs @@ -209,7 +209,7 @@ public class AsyncQueryableExecuter : IAsyncQueryableExecuter, ISingletonDepende return Task.FromResult(queryable.SingleOrDefault(predicate))!; } - public Task MinAsync(IQueryable queryable, CancellationToken cancellationToken = default) + public Task MinAsync(IQueryable queryable, CancellationToken cancellationToken = default) { var provider = FindProvider(queryable); @@ -221,7 +221,7 @@ public class AsyncQueryableExecuter : IAsyncQueryableExecuter, ISingletonDepende return Task.FromResult(queryable.Min())!; } - public Task MinAsync(IQueryable queryable, Expression> selector, CancellationToken cancellationToken = default) + public Task MinAsync(IQueryable queryable, Expression> selector, CancellationToken cancellationToken = default) { var provider = FindProvider(queryable); @@ -233,7 +233,7 @@ public class AsyncQueryableExecuter : IAsyncQueryableExecuter, ISingletonDepende return Task.FromResult(queryable.Min(selector))!; } - public Task MaxAsync(IQueryable queryable, CancellationToken cancellationToken = default) + public Task MaxAsync(IQueryable queryable, CancellationToken cancellationToken = default) { var provider = FindProvider(queryable); @@ -245,7 +245,7 @@ public class AsyncQueryableExecuter : IAsyncQueryableExecuter, ISingletonDepende return Task.FromResult(queryable.Max())!; } - public Task MaxAsync(IQueryable queryable, Expression> selector, CancellationToken cancellationToken = default) + public Task MaxAsync(IQueryable queryable, Expression> selector, CancellationToken cancellationToken = default) { var provider = FindProvider(queryable); diff --git a/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/IAsyncQueryableExecuter.cs b/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/IAsyncQueryableExecuter.cs index 2bea6c4604..4ee0666f4c 100644 --- a/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/IAsyncQueryableExecuter.cs +++ b/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/IAsyncQueryableExecuter.cs @@ -137,12 +137,12 @@ public interface IAsyncQueryableExecuter #region Min - Task MinAsync( + Task MinAsync( [NotNull] IQueryable queryable, CancellationToken cancellationToken = default); - Task MinAsync( + Task MinAsync( [NotNull] IQueryable queryable, [NotNull] Expression> selector, CancellationToken cancellationToken = default); @@ -151,12 +151,12 @@ public interface IAsyncQueryableExecuter #region Max - Task MaxAsync( + Task MaxAsync( [NotNull] IQueryable queryable, CancellationToken cancellationToken = default); - Task MaxAsync( + Task MaxAsync( [NotNull] IQueryable queryable, [NotNull] Expression> selector, CancellationToken cancellationToken = default); diff --git a/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/IAsyncQueryableProvider.cs b/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/IAsyncQueryableProvider.cs index 3f38553ac5..3239fde6d6 100644 --- a/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/IAsyncQueryableProvider.cs +++ b/framework/src/Volo.Abp.Threading/Volo/Abp/Linq/IAsyncQueryableProvider.cs @@ -139,12 +139,12 @@ public interface IAsyncQueryableProvider #region Min - Task MinAsync( + Task MinAsync( [NotNull] IQueryable queryable, CancellationToken cancellationToken = default); - Task MinAsync( + Task MinAsync( [NotNull] IQueryable queryable, [NotNull] Expression> selector, CancellationToken cancellationToken = default); @@ -153,12 +153,12 @@ public interface IAsyncQueryableProvider #region Max - Task MaxAsync( + Task MaxAsync( [NotNull] IQueryable queryable, CancellationToken cancellationToken = default); - Task MaxAsync( + Task MaxAsync( [NotNull] IQueryable queryable, [NotNull] Expression> selector, CancellationToken cancellationToken = default);