FieldManager updates childrens in the order of each field is declared, when using a code generator utility I add other childrens in a partial class. Some of the generated fields depends on my childrens:
TableA:
TableA_ID; (PK, int autoincrement)
TableB_ID; (FK , int, TableB, TableB_ID, Nullable);
TableB:
TableB_ID; (PK, int autoincrement)
partial class ClassA
{
static TableA;
}
partial class ClassB
{
static TableB;
}
TableA::Child_Update(ClassA parent)
{
if(parent.TableB != null)
TableB_ID = parent.TableB.TableB_ID;
.....
}
I need that FieldManager inserts TableB first, and then TableA, instead of the normal order.
I think that the easiest solution is declare the two childrens manually. I have added a method UpdateChildren(string[] childrensOrder) to FieldManager, a derived class from BusinessBase and a virtual property UpdateChildrensOrder.
What you think? I'm making complex the problem?
Instead of using FieldManager.UpdateChildren, call DataPortal.UpdateChild. That's all UpdateChildren does anyway, but you'll be able to control the ordering.
Copyright (c) Marimer LLC