Remove `CheckChangeTracking` method.

pull/17491/head
maliming 2 years ago
parent 0f7910a57d
commit 6d029f5fd1
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4

@ -108,7 +108,6 @@ public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IE
public async override Task<TEntity> InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
CheckChangeTracking();
CheckAndSetId(entity);
var dbContext = await GetDbContextAsync();
@ -125,7 +124,6 @@ public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IE
public async override Task InsertManyAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default)
{
CheckChangeTracking();
var entityArray = entities.ToArray();
if (entityArray.IsNullOrEmpty())
{
@ -161,7 +159,6 @@ public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IE
public async override Task<TEntity> UpdateAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
CheckChangeTracking();
var dbContext = await GetDbContextAsync();
dbContext.Attach(entity);
@ -184,8 +181,6 @@ public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IE
return;
}
CheckChangeTracking();
cancellationToken = GetCancellationToken(cancellationToken);
if (BulkOperationProvider != null)
@ -212,7 +207,6 @@ public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IE
public async override Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{
CheckChangeTracking();
var dbContext = await GetDbContextAsync();
dbContext.Set<TEntity>().Remove(entity);
@ -231,8 +225,6 @@ public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IE
return;
}
CheckChangeTracking();
cancellationToken = GetCancellationToken(cancellationToken);
if (BulkOperationProvider != null)
@ -325,7 +317,6 @@ public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IE
public async override Task DeleteAsync(Expression<Func<TEntity, bool>> predicate, bool autoSave = false, CancellationToken cancellationToken = default)
{
CheckChangeTracking();
var dbContext = await GetDbContextAsync();
var dbSet = dbContext.Set<TEntity>();
@ -446,15 +437,6 @@ public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IE
true
);
}
protected virtual void CheckChangeTracking()
{
if (!ShouldTrackingEntityChange())
{
Logger.LogWarning("This repository has disabled change tracking. Your changes may not be saved!");
}
}
}
public class EfCoreRepository<TDbContext, TEntity, TKey> : EfCoreRepository<TDbContext, TEntity>,

Loading…
Cancel
Save