-
-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Description
Hi,
I have the following model:
public class Person
{
public Person()
{
Id = Guid.NewGuid();
WorkItems = new List<WorkItem>();
}
public Guid Id { get; set; }
public string Name { get; set; }
public ICollection<WorkItem> WorkItems { get; set; }
}
public class WorkItem
{
public WorkItem()
{
Id = Guid.NewGuid();
}
public Guid Id { get; set; }
public string Description { get; set; }
public Person Creator { get; set; }
}
My fluent API looks like this:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Person>()
.HasMany(p => p.WorkItems)
.WithRequired()
.WillCascadeOnDelete();
}
When I use Graphdiff to update this small graph, I find that the Creator_Id Column in the WorkItem table is constantly set to the same as Person_id column.
I can't understand why this is happening. Is this a bug?
My graphdiff code to update the graph looks like this:
public static void UpdatePerson(Person person)
{
using (var context = new GraphDiffTestDbContext())
{
context.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
context.UpdateGraph(person, map => map
.OwnedCollection(p => p.WorkItems, with => with.AssociatedEntity(p => p.Creator))
);
context.SaveChanges();
}
}
JoschaHemlep
Metadata
Metadata
Assignees
Labels
No labels