Closed cryo75 closed 9 years ago
Hi,
I'm not exactly sure about the relations in your scenario: do you have multiple associated entities or do you have a single collection of multiple associated entities?
Anyways, it should work like this for the first case (more than one navigation property):
var attachedRoot = context.UpdateGraph(changedRoot,
a => a.OwnedCollection(b => b.OwnedCollection,
with => with.AssociatedEntity(d => d.FirstAssociate)
.AssociatedEntity(d => d.SecondAssociate)));
And like this for the second case (the navigation property is a collection):
var attachedRoot = context.UpdateGraph(changedRoot,
a => a.OwnedCollection(b => b.OwnedCollection,
with => with.AssociatedCollection(d => d.AssociatedCollection)));
Thanks. It is the first case.
But I don't understand the second case.
Hi,
in the second case you'd have multiple associated entities of the same type contained within a single collection. The classes would look something like this:
public class Root
{
// [..] Id (Primary Key) etc.
public List<OwnedEntity> OwnedCollection { get; set; }
}
public class OwnedEntity
{
// [..] Id (Primary Key) etc.
public List<AssociatedEntity> AssociatedCollection { get; set; }
}
public class AssociatedEntity
{
// [..] Id (Primary Key) etc.
}
Is it possible to update such a graph?