Ok let me explain my DB schema a bit here. I have two tables that I am working with, Process, and ProcessPredecessor
Here is how Process looks:
ProcessId
ProcessName
... etc
This is how ProcessPredecessor looks:
ProcessPredecessorId
ProcessId (original process)
PredecessorId (predecessor process)
LLBLGen created the ProcessPredecessor entity, and it has these two fields, Process and Process_. Also, in the process entity, we have ProcessPredecessor entity collection (Everything seems OK at this point).
Process field in ProcessPredecessor is mapped by ProcessId FK
Process_ field in ProcessPredecessor is mapped by PredecessorId FK
I have two sperate programs that I am working with. One program converts a Microsft Project XML file and creates my process hiararchy. The other program is meant to persist it. In Microsoft Project, the Predecessors are created by referencing their UID. So each process is giving the UID from project. In that conversation, I have a method which assigns the Predecessor, something like this:
ProcessPredecessor pd = new ProcessPredecessor();
pd.ProcessId = procId;
pd.PredecessorId = predId;
return pd;
pd is then added to the process.ProcessPredecessor collection (nothing unusual about this).
First problem: After the process entities are constructed, predecessor.Process is not null, but predecessor.Process_ is null (even though BOTH FK's were set).
Second problem: When trying to recursively save the process entities' ProcessPredecessor collection, it throws a FK_Constraint error. I took off the FK constraint in the DB, and it appears the the first foreign key is being synchronized, and the second (predecessorId) did not updated correctly.
Let me know if anything needs further explaination.