Adding Collections



I am trying to do some experiment with this framework. Query is working fine. Though I am having some discomfort against exposing the entities while using oData. I don't know what are other ways possible to avoid this.

But my mail problem is, while I am trying to create an order object along with its child collection object OrderDetail and trying to insert, I get an error. It says

"The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: A referential integrity constraint violation occurred: The property value(s) of 'Order.OrderID' on one end of a relationship do not match the property value(s) of 'OrderDetail.OrderID' on the other end."

There are no such example to show how to add object and its collection together. Can you please get back?

Many Thanks