我已经在我的dotnet核心Web应用程序中使用了此Reconciler plugin。
它类似于GraphDiff,但是此插件支持ef内核。
我在更新模型时有这些行。
_context.Reconcile(applicationForm, r => r.WithMany(m => m.AccessArea).WithMany(m => m.TrainingRecord));
await _context.SaveChangesAsync();
问题是,Reconcile()不接受null参数,因此当我传递null子实体时会出错。
AggregateException: One or more errors occurred. (Value cannot be null. Parameter name: source)
有任何解决方法吗?
非常感谢!
答案 0 :(得分:0)
我设法通过将它们设为空列表而不是null来解决此问题。
干杯!
if (applicationForm.AccessArea == null)
{
applicationForm.AccessArea = new List<AccessAreaCheckBox>();
}
if (applicationForm.TrainingRecord == null)
{
applicationForm.TrainingRecord = new List<FilePath>();
}