© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•13mo ago•
3 replies
lime_soft

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 } }
Foo { Baz { Id: 1, FooId: 2 } }
, i don't want
Baz.SomeOtherProp
Baz.SomeOtherProp
to be null i just want it to stay the same
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Entity framework core - database
C#CC# / help
2y ago
Entity Framework Core - how to setup this navigation correctly?
C#CC# / help
3y ago
Entity Framework not creating tables
C#CC# / help
4y ago
C# Entity core framework gaslighting
C#CC# / help
2y ago