Adapter / v.2.0
Hi,
I am currently facing a strange problem when trying to update an entity. The object model I have looks as follows:
- Customer entity with "n" linked order entities
Now, I am reading a single customer entity and prefetch all the order entities. Then I wanna execute an operation on one of the prefetched order entities. The code looks like this:
order.Document = doc.Id;
bool test = order.IsNew; // result is FALSE, so the entity is not new
DataAdapter.SaveEntity(order, true); // --> Exception!
The exception occurs because a field is set to NULL but it can't be NULL in the db. So I started to investigate and found out that a INSERT instead of an UPDATE statement is executed! Why??? How is that possible?
I actually know a workaround (using UpdateEntitiesDirectly) but I was wondering how that can be possible!?!