lime_soft
lime_soft
CC#
Created by lime_soft on 2/4/2025 in #help
Entity Framework Core updating tables in navigation fields
so in efcore lets say i have an entity Foo and Baz:
public class Foo
{
public int Id {get;set;}
public ICollection<Baz> Bazs {get;set}
}

public class Baz
{
public int Id {get;set;}
public string SomeOtherProp {get;set}
public int FooId {get;set}
}
public class Foo
{
public int Id {get;set;}
public ICollection<Baz> Bazs {get;set}
}

public class Baz
{
public int Id {get;set;}
public string SomeOtherProp {get;set}
public int FooId {get;set}
}
my question is if i try to update Foo how can i efcore to only update the FooId property in Baz if i pass Foo { Baz { Id: 1, FooId: 2 } }, i don't want Baz.SomeOtherProp to be null i just want it to stay the same
4 replies