保存のために DbContext にいくつかのアクションがあります。
Material と Colors の 2 つのエンティティがあります。エンティティには多対多の関係があります。
私はこれをしようとします:
var color = context
.Colors
.Include("Materials")
.Where(g => g.Id == (colorId))
.FirstOrDefault();
var mater = context
.Materials
.Include("Colors")
.SingleOrDefault(c => c.Name == material.Name);
mater.Colors.Add(color);
context.SaveChanges();
プログラムを実行しようとするとcontext.SaveChanges()
、例外がスローされますDbUpdateException
Unable to update the EntitySet 'MaterialColors' because it has a
DefiningQuery and no <InsertFunction> element exists in
the <ModificationFunctionMapping> element to support the current operation.
それを解決する方法は?