| | |
| | | using Microsoft.EntityFrameworkCore.Metadata.Builders; |
| | | using Microsoft.EntityFrameworkCore.Migrations; |
| | | using Microsoft.Extensions.Configuration; |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | ? p.IsModified |
| | | : true) |
| | | .ToDictionary(p => p.Metadata.Name, p => p.OriginalValue)); |
| | | Db.GetRepository<DbAuditLog, LogDbContextLocator>().InsertNow(log); |
| | | // 创建独立作用域 |
| | | using (var scope = App.GetRequiredService<IServiceScopeFactory>().CreateScope()) |
| | | { |
| | | var rep = scope.ServiceProvider.GetRequiredService<IRepository<DbAuditLog, LogDbContextLocator>>(); |
| | | rep.InsertNow(log); |
| | | } |
| | | } |
| | | } |
| | | } |