Skip to content

Commit

Permalink
Merge pull request #133 from Ali-YousefiTelori/develop
Browse files Browse the repository at this point in the history
Fix set uid and creation date time in update
  • Loading branch information
Ali-YousefiTelori authored Jan 12, 2024
2 parents 25adb93 + b3e87f6 commit 4b2637b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.0.96</Version>
<Version>0.0.0.97</Version>
<Description>asp core servces.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,services,asp,aspnet</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.0.96</Version>
<Version>0.0.0.97</Version>
<Description>asp core servces.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,services,asp,aspnet,aspcore,efcore</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.0.96</Version>
<Version>0.0.0.97</Version>
<Description>core of database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,client,clients</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.0;netstandard2.1;net45;net6.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.0.96</Version>
<Version>0.0.0.97</Version>
<Description>core contracts.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,contract,contracts,dto,dtos</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,12 +578,20 @@ private async Task<ListMessageContract<TEntity>> InternalUpdateBulk<TEntity>(IEa
return (FailedReasonType.AccessDenied, $"Some items you want to update not found!");

var result = await easyWritableQueryable.UpdateBulkAsync(entities, cancellationToken);
var uniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(_logicOptions);

foreach (var entityEntry in easyWritableQueryable.Context.GetTrackerEntities().ToArray())
{
if (entityEntry.EntityState != EasyMicroservices.Database.DataTypes.EntityStateType.Modified
&& entityEntry.EntityState != EasyMicroservices.Database.DataTypes.EntityStateType.Deleted)
continue;
if (entityEntry.EntityState == EasyMicroservices.Database.DataTypes.EntityStateType.Added)
{
if (entityEntry.Entity is IDateTimeSchema addschema)
addschema.CreationDateTime = DateTime.Now;
if (entityEntry.Entity is IUniqueIdentitySchema uidschema)
uidschema.UniqueIdentity = uniqueIdentity;
}
if (updateOnlyChangedValue)
UpdateOnlyChangedValue(easyWritableQueryable.Context, entityEntry.Entity);
if (entityEntry.Entity is IDateTimeSchema schema)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>netstandard2.0;netstandard2.1;net45;net6.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.0.96</Version>
<Version>0.0.0.97</Version>
<Description>core of database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.0.96</Version>
<Version>0.0.0.97</Version>
<Description>ef core of database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,ef,efcore</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<Version>0.0.0.96</Version>
<Version>0.0.0.97</Version>
<Description>ef core of Relational database.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>core,cores,base,database,ef,efcore,Relational</PackageTags>
Expand Down

0 comments on commit 4b2637b

Please sign in to comment.