I'm having problems mapping relations. I come from Hibernate as an ORM, and have troubles "adapting" i think...
Suppose I have a Customer entity, a Destination entity, an Order and OrderItems entities .
Each order has *one* customer and can have an *optional* destination, and one or more OrderIrtems.
Assuming the primary keys are all integer, how would I map this?
Coming from Hibernate I would map Customer and Destination as attributes in the Order entity, and OrderItems as an List<OrderItems> in Order.
Then if I don't have a Destination to set I would just leave it as null.
If I map this way in OpenNetCF.ORM, the foreing keys are not being set in the Insert method.
So i tried to map the foreing keys as integers in the Order entity, leaving the Customer attribute as a read only "placeholder".
This sorts of work, but if I don't set a Destination I get errors in the OnInsert method (since the array that holds the Destination property has only one null element).
The error occurs in the
foreach (var element in valueArray
loop, since element would be set as null.
I know I'm mapping the whole thing wrong.... Can anyone give a pointer on how to fix this?
Please is pretty urgent.