We are using the following system setup:
- WCF Data Services 5.1.0-RC2
- Entity Framework 4.0
Problem: We are trying to create and save nested/related entities on client side using WCF Data Services. If we try to save using following code:
ParentEntity pEntity = context.pEntity;
ChildEntity cEntity = new ChildEntity();
pEntity.childEntities.Add(cEntity);
context.SaveChanges();
then it doesn't work. Nothing is saved at the Database and there is no exception thrown. This is normally working fine with only the Entity Model, but not in connection with the WCF Data Service.
Can you also call the following API before SaveChanges call:
context.AddRelatedObject("ParentEntitySet", "childEntities", cEntity);