I have a base recipe class and I am using a datacontext. I overrode the insert method for the recipe in the datacontext and am trying to insert into its children. Nomatter what I do I cannot get the child to insert.Currently, just the recipe inserts and nothing happens with the child.
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); }
I have tried everything I can think of. I even instantiated another datacontext in the method and after the instance came back from ExecuteDynamicInsert with the id, tried to add it, and I get timeout errors.
I figured it out. Override SubmitChanges in the DataContext, and find all of the inserts and updates that are recipes. Run the algorithm to add children there.