FalconExtend/Falcon.AutoTableLog/DbContextAutoSaveLog.cs

28 lines
751 B
C#
Raw Normal View History

2019-08-26 09:23:35 +08:00
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using Microsoft.EntityFrameworkCore.ChangeTracking;
namespace Falcon.AutoTableLog
{
public class DbContextAutoSaveLog<TDbContext> where TDbContext : DbContext
{
public TDbContext Db { get; set; }
public DbContextAutoSaveLog(TDbContext db) {
this.Db = db;
}
public void GetDbContextEvent() {
this.Db.ChangeTracker.Tracked += (object sender,EntityTrackedEventArgs e) => {
var a = e.Entry.OriginalValues;
};
foreach(var en in this.Db.ChangeTracker.Entries()) {
}
}
}
}