How can I log all entities change, during .SaveChanges() using EF code first?
问题 I'm using EF code first . I'm using a base Repository for all my repositories and an IUnitofWork that inject to the repositories, too: public interface IUnitOfWork : IDisposable { IDbSet<TEntity> Set<TEntity>() where TEntity : class; int SaveChanges(); } public class BaseRepository<T> where T : class { protected readonly DbContext _dbContext; protected readonly IDbSet<T> _dbSet; public BaseRepository(IUnitOfWork uow) { _dbContext = (DbContext)uow; _dbSet = uow.Set<T>(); } //other methods } e