Browse Source
Merge pull request #2018 from abpframework/maliming/background
Modify the entity update way of BackgroundJobStore
pull/2171/head
Halil İbrahim Kalkan
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
18 additions and
8 deletions
-
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj
-
modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs
|
|
|
@ -6,9 +6,9 @@ |
|
|
|
</PropertyGroup> |
|
|
|
|
|
|
|
<ItemGroup> |
|
|
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4"> |
|
|
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0"> |
|
|
|
<PrivateAssets>all</PrivateAssets> |
|
|
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|
|
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> |
|
|
|
</PackageReference> |
|
|
|
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" /> |
|
|
|
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore.SqlServer\Volo.Abp.EntityFrameworkCore.SqlServer.csproj" /> |
|
|
|
|
|
|
|
@ -74,16 +74,26 @@ namespace Volo.Abp.BackgroundJobs |
|
|
|
|
|
|
|
public void Update(BackgroundJobInfo jobInfo) |
|
|
|
{ |
|
|
|
BackgroundJobRepository.Update( |
|
|
|
ObjectMapper.Map<BackgroundJobInfo, BackgroundJobRecord>(jobInfo) |
|
|
|
); |
|
|
|
var backgroundJobRecord = BackgroundJobRepository.Find(jobInfo.Id); |
|
|
|
if (backgroundJobRecord == null) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
ObjectMapper.Map(jobInfo, backgroundJobRecord); |
|
|
|
BackgroundJobRepository.Update(backgroundJobRecord); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task UpdateAsync(BackgroundJobInfo jobInfo) |
|
|
|
{ |
|
|
|
await BackgroundJobRepository.UpdateAsync( |
|
|
|
ObjectMapper.Map<BackgroundJobInfo, BackgroundJobRecord>(jobInfo) |
|
|
|
); |
|
|
|
var backgroundJobRecord = await BackgroundJobRepository.FindAsync(jobInfo.Id); |
|
|
|
if (backgroundJobRecord == null) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
ObjectMapper.Map(jobInfo, backgroundJobRecord); |
|
|
|
await BackgroundJobRepository.UpdateAsync(backgroundJobRecord); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|