public static List <EFChangeInfo> GetEFChanges(this EFDbContext eFDbContext) { var changes = eFDbContext.GetChangeTracker()?.Entries(); if (changes == null) { return(null); } List <EFChangeInfo> list = new List <EFChangeInfo>(); foreach (var change in changes) { var tableName = string.Empty; Type type = change.Entity.GetType(); var thisTableAttribute = typeof(TableAttribute); TableAttribute attri = null; if (type.IsDefined(thisTableAttribute, true)) { attri = type.GetCustomAttributes(thisTableAttribute, true).FirstOrDefault() as TableAttribute; tableName = attri?.Name; tableName = string.IsNullOrEmpty(tableName) ? type.Name : tableName; } list.Add(new EFChangeInfo { TableName = tableName }); } return(list); }