We're currently using version 5.5 (5.5.0) RTM, Build Date: 02-Nov-2018
Our application has the following table structure
- Trade
-
Trade Detail
(m:1) relationship to trade, this relationship is not optional
-
Trade Price
(m:1) relationship to Trade Detail, this relationship is not optional
(m:1) relationship to Calculated Value, this relationship is optional
- CalculatedValue
-
CalculatedValueVariable
(m:1) relationship to CalculatedValue, this relationship is not optional
We have a process that builds out a full structure similar to as follows
A trade record with 1 or more details
Each detail has 1 or more prices
Each price ties to 1 calculation. For the purposes of this process, the calculation is unique to the price, even though the relationship does not require it to be (a single calculation could point to more than one trade price in theory).
Each calculation has multiple variables tied to it.
This process happens several times and then we call adapter.SaveEntityCollection(toSave, true, true) on the results to save recursively and refetch. The adapter is an instance of IDataAccessAdapter.
What we've found is that all of the entities get saved and can be queried in the database individually. Additionally I can look through the structure in the debugger and see id values on all of the items in memory. For some reason however, the connection between Trade Price and Calculation (a foreign key column called CalculatedValueId) isn't set in the database.
Even more odd, is that after the save the CalculatedValueId is set on the TradePrice object and it ties to a record in the database (if I query through sql), its just that the same column on the trade price record in the database is null.
If we call adapter.SaveEntityCollection(toSave, true, true) a second time then the connection is persisted to the foreign key column in the database.
Can you speak to what we're missing? Thanks!