1

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.

Hiead
  • 93
  • 9

1 Answers1

0

Can you also call the following API before SaveChanges call:

context.AddRelatedObject("ParentEntitySet", "childEntities", cEntity);

Pratik
  • 607
  • 4
  • 4
  • Then its would be saved, but the Item is only in the context but not related to the Parent Entity. And the second Problem is, that i have not the context on the situation, i only have the Parent Entity. So i can not call the Method "AddRelatedObject". – Hiead Oct 24 '12 at 08:09