使用MVC jQuery,.NET Core,ABP v3.5.0。
实体历史记录已启用: Configuration.EntityHistory.IsEnabled = true;
我使用t-sql将一些数据直接插入到表中。然后,如果我尝试通过Web应用程序更新这些记录之一,则会看到引发的异常:
System.NullReferenceException:对象引用未设置为对象的实例。
System.NullReferenceException: Object reference not set to an instance of an object.
at Abp.EntityHistory.EntityHistoryHelper.ShouldSavePropertyHistory(PropertyEntry propertyEntry, Boolean defaultValue) in D:\Github\aspnetboilerplate\src\Abp.ZeroCore.EntityFrameworkCore\EntityHistory\EntityHistoryHelper.cs:line 292
at Abp.EntityHistory.EntityHistoryHelper.GetPropertyChanges(EntityEntry entityEntry) in D:\Github\aspnetboilerplate\src\Abp.ZeroCore.EntityFrameworkCore\EntityHistory\EntityHistoryHelper.cs:line 210
at Abp.EntityHistory.EntityHistoryHelper.CreateEntityChangeInfo(EntityEntry entityEntry) in D:\Github\aspnetboilerplate\src\Abp.ZeroCore.EntityFrameworkCore\EntityHistory\EntityHistoryHelper.cs:line 160
at Abp.EntityHistory.EntityHistoryHelper.CreateEntityChangeSet(ICollection`1 entityEntries) in D:\Github\aspnetboilerplate\src\Abp.ZeroCore.EntityFrameworkCore\EntityHistory\EntityHistoryHelper.cs:line 95
at Abp.Zero.EntityFrameworkCore.AbpZeroCommonDbContext`3.<SaveChangesAsync>d__98.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
我禁用了“实体历史记录”,并删除了“实体历史记录”选择器,现在对于使用t-sql直接插入表中的记录,更新再次起作用。
Configuration.EntityHistory.IsEnabled = false;
//Configuration.EntityHistory.Selectors.Add(
// new NamedTypeSelector(
// "Abp.AuditedEntity",
// type => typeof(IAudited).IsAssignableFrom(type)
// )
//);
实体历史记录功能是否取决于必须通过Web应用程序插入的数据?
相关分类