Hi,
I am using silverlight client with ado.net dataservices on entity framework.
I have an Entity Contact and an Entity Address which is related with a foreign key relation ship... A contact can have 1 or more Adresses but a Address needs always at least 1 contact.. pretty basic...
I have a Repository for my contacts and Address which has a Method Add(T entity),...
On my Client I have a form with allows users to add a contact with an address
and I want to save both away to the database...
Address a = new Address();
a.Street="Street",
a.City = "City"
a.Contact =
new Contact(){ Name="Name",Age="60"}
_repository.Add(a);
....
Ok i figured out that I can not save a related object graph right away so i did something like this
DataBaseEntities.AddToContact(obj2Badded.Contact);
DataBaseEntities.AddToAddress(obj2Badded);
DataBaseEntities.SetLink(obj2Badded,"Contact",object2Badded.Contact);
DataBaseEinties.BeginSaveChanges(...)
Is there away to do this in transations like when contact is not added address will also not be added and vice versa...
... and all what I have tried is not working...
It would be great if someone can point me in the right direction on this topic I simply want to add a related object graph =} ...