From 236730c0717f4e89f9a87a3ef040efbb37360362 Mon Sep 17 00:00:00 2001 From: Ali Yousefi Date: Thu, 15 Feb 2024 23:47:03 +0330 Subject: [PATCH 1/2] Fix null reference bug --- .../EasyMicroservices.Cores.AspCoreApi.csproj | 2 +- .../MultilingualReadableQueryServiceController.cs | 1 + .../ReadableQueryServiceController.cs | 2 ++ .../EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj | 2 +- .../EasyMicroservices.Cores.Clients.csproj | 2 +- .../EasyMicroservices.Cores.Contracts.csproj | 2 +- .../EasyMicroservices.Cores.Database.csproj | 2 +- .../EasyMicroservices.Cores.EntityFrameworkCore.csproj | 2 +- .../EasyMicroservices.Cores.Infrastructure.csproj | 2 +- ...asyMicroservices.Cores.Relational.EntityFrameworkCore.csproj | 2 +- 10 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj index b4ffe96..ed5da2e 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj +++ b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj @@ -4,7 +4,7 @@ netstandard2.1;net6.0;net7.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.1.54 + 0.0.1.55 asp core servces. EasyMicroservices@gmail.com core,cores,base,database,services,asp,aspnet diff --git a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/MultilingualReadableQueryServiceController.cs b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/MultilingualReadableQueryServiceController.cs index 38c3540..7cad9f4 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/MultilingualReadableQueryServiceController.cs +++ b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/MultilingualReadableQueryServiceController.cs @@ -66,6 +66,7 @@ public MultilingualReadableQueryServiceController(IBaseUnitOfWork unitOfWork, IC public MultilingualReadableQueryServiceController(IBaseUnitOfWork unitOfWork) { ContractLogic = unitOfWork.GetReadableContractLogic(); + UnitOfWork = unitOfWork; } async Task> ResolveContentLanguage(MessageContract result, string languageShortName) diff --git a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/ReadableQueryServiceController.cs b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/ReadableQueryServiceController.cs index 03c2bfd..450440c 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/ReadableQueryServiceController.cs +++ b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/ReadableQueryServiceController.cs @@ -63,7 +63,9 @@ public ReadableQueryServiceController(IBaseUnitOfWork unitOfWork, IContractReada public ReadableQueryServiceController(IBaseUnitOfWork unitOfWork) { ContractLogic = unitOfWork.GetReadableContractLogic(); + UnitOfWork = unitOfWork; } + /// /// /// diff --git a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj index 3602ed4..ef4ff20 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj +++ b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj @@ -4,7 +4,7 @@ net6.0;net7.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.1.54 + 0.0.1.55 asp core servces. EasyMicroservices@gmail.com core,cores,base,database,services,asp,aspnet,aspcore,efcore diff --git a/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj b/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj index 0a5c7bc..cb732de 100644 --- a/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.1.54 + 0.0.1.55 core of database. EasyMicroservices@gmail.com core,cores,base,client,clients diff --git a/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj b/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj index a8725f6..6797f22 100644 --- a/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net45;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.1.54 + 0.0.1.55 core contracts. EasyMicroservices@gmail.com core,cores,base,contract,contracts,dto,dtos diff --git a/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj b/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj index 6d33da7..d7ec9af 100644 --- a/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net45;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.1.54 + 0.0.1.55 core of database. EasyMicroservices@gmail.com core,cores,base,database diff --git a/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj b/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj index fa41dae..737a5be 100644 --- a/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj +++ b/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj @@ -4,7 +4,7 @@ netstandard2.1;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.1.54 + 0.0.1.55 ef core of database. EasyMicroservices@gmail.com core,cores,base,database,ef,efcore diff --git a/src/CSharp/EasyMicroservices.Cores.Infrastructure/EasyMicroservices.Cores.Infrastructure.csproj b/src/CSharp/EasyMicroservices.Cores.Infrastructure/EasyMicroservices.Cores.Infrastructure.csproj index f3cf6e7..9081514 100644 --- a/src/CSharp/EasyMicroservices.Cores.Infrastructure/EasyMicroservices.Cores.Infrastructure.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Infrastructure/EasyMicroservices.Cores.Infrastructure.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net45;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.1.54 + 0.0.1.55 core of infrastructure. EasyMicroservices@gmail.com core,cores,base,infrastructure diff --git a/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj b/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj index 2d38660..db0f698 100644 --- a/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj @@ -4,7 +4,7 @@ netstandard2.1;net6.0;net7.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.1.54 + 0.0.1.55 ef core of Relational database. EasyMicroservices@gmail.com core,cores,base,database,ef,efcore,Relational From b7c578bb8cafba105824fd3a0b3fae87ca61ece7 Mon Sep 17 00:00:00 2001 From: Ali Yousefi Date: Thu, 15 Feb 2024 23:52:58 +0330 Subject: [PATCH 2/2] fix uniqueidentity --- .../Database/Widgets/SimpleReportingEntityWidget.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/CSharp/EasyMicroservices.Cores.Database/Database/Widgets/SimpleReportingEntityWidget.cs b/src/CSharp/EasyMicroservices.Cores.Database/Database/Widgets/SimpleReportingEntityWidget.cs index 8d83820..4d7c42c 100644 --- a/src/CSharp/EasyMicroservices.Cores.Database/Database/Widgets/SimpleReportingEntityWidget.cs +++ b/src/CSharp/EasyMicroservices.Cores.Database/Database/Widgets/SimpleReportingEntityWidget.cs @@ -70,6 +70,8 @@ public async Task AddProcess(IDatabaseWidgetManager databaseWidgetManager, IBase DoStopReporting = true }); DatabaseExtensions.SetIdToRecordId(logic.GetReadableContext(), entity, reportEntity); + if (reportEntity is IUniqueIdentitySchema reportUniqueIdentity && entity is IUniqueIdentitySchema entityUniqueIdentity) + reportUniqueIdentity.UniqueIdentity = entityUniqueIdentity.UniqueIdentity; await logic .Add(reportEntity, cancellationToken) .AsCheckedResult(); @@ -93,6 +95,13 @@ public async Task AddBulkProcess(IDatabaseWidgetManager databaseWidgetManager, I DoStopReporting = true }); DatabaseExtensions.SetIdToRecordId(logic.GetReadableContext(), reportEntities); + foreach (var item in reportEntities) + { + DatabaseExtensions.SetIdToRecordId(logic.GetReadableContext(), item.Key, item.Value); + if (item.Key is IUniqueIdentitySchema reportUniqueIdentity && item.Value is IUniqueIdentitySchema entityUniqueIdentity) + reportUniqueIdentity.UniqueIdentity = entityUniqueIdentity.UniqueIdentity; + } + await logic .AddBulk(reportEntities.Values.ToList(), cancellationToken) .AsCheckedResult();