我有一個基本的配方類,我正在使用一個datacontext。我覆蓋了datacontext中配方的插入方法,並試圖插入到它的子項中。無論我做什麼我都無法讓孩子插入。目前,只有配方插入,孩子沒有任何反應。LinqToSql重寫插入與內部類C#
partial void InsertRecipe(Recipe instance)
{
// set up the arrays
for (int x = 0; x < instance.PlainIngredients.Count; ++x)
{
instance.TextIngredients.Add(new TextIngredient()
{
StepNumber = x + 1,
Text = instance.PlainIngredients[x]
});
}
this.ExecuteDynamicInsert(instance);
}
我試過了我能想到的一切。我甚至在該方法中實例化了另一個datacontext,並且在實例從ExecuteDynamicInsert帶上id後試圖添加它,並且出現超時錯誤。