Would you help me with the following scenario?
When I add a new entity with a foreign key the keys are not added automatically after I call context.SaveChanges().
class Parent
{
Guid Id;
string name;
}
class Child
{
Parent parent;
Guid ParentId;
Guid Id;
string name;
}
Parent parent = new Parent
{
Id = Guid.NewGuid(),
name = "parent"
}
Child child = new Child
{
Parent = parent,
Id = Guid.NewGuid(),
name = "child"
}
context.Childs.Add(child);
context.SaveChanges();
but when I get the ParentId of the child (context.Childs.First().ParentId) the value is null. In EF that behavior do not happen, when I use EF the ParentId property has the guid of the parent.
How can I get the same behavior with this library?
Would you help me with the following scenario?
When I add a new entity with a foreign key the keys are not added automatically after I call context.SaveChanges().
but when I get the ParentId of the child (context.Childs.First().ParentId) the value is null. In EF that behavior do not happen, when I use EF the ParentId property has the guid of the parent.
How can I get the same behavior with this library?