pull/5966/head
Ahmet 5 years ago
parent bba47d4450
commit 2559606e13

@ -7,6 +7,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
@ -141,9 +142,21 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
return GetQueryable().IncludeDetails();
}
public Task<EntityChange> GetEntityChange(Guid entityChangeId)
public virtual async Task<EntityChange> GetEntityChange(Guid entityChangeId)
{
return DbContext.Set<EntityChange>().AsNoTracking().IncludeDetails().OrderBy(x => x.Id).Where(x => x.Id == entityChangeId).FirstAsync();
var entityChange = await DbContext.Set<EntityChange>()
.AsNoTracking()
.IncludeDetails()
.OrderBy(x => x.Id)
.Where(x => x.Id == entityChangeId)
.FirstOrDefaultAsync();
if (entityChange == null)
{
throw new EntityNotFoundException(typeof(EntityChange));
}
return entityChange;
}
public virtual async Task<List<EntityChange>> GetEntityChangeListAsync(

@ -8,6 +8,7 @@ using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.MongoDB;
@ -142,10 +143,17 @@ namespace Volo.Abp.AuditLogging.MongoDB
public virtual async Task<EntityChange> GetEntityChange(Guid entityChangeId)
{
return (await GetMongoQueryable()
.Where(x => x.EntityChanges.Any(y => y.Id == entityChangeId))
.FirstAsync()
).EntityChanges.First(x => x.Id == entityChangeId);
var entityChange = (await GetMongoQueryable()
.Where(x => x.EntityChanges.Any(y => y.Id == entityChangeId))
.FirstAsync()).EntityChanges.FirstOrDefault(x => x.Id == entityChangeId);
if (entityChange == null)
{
throw new EntityNotFoundException(typeof(EntityChange));
}
return entityChange;
}
public virtual async Task<List<EntityChange>> GetEntityChangeListAsync(

Loading…
Cancel
Save