© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
66 replies
schwartzmj

❔ Updating EF entity with object containing optional properties

I'm writing an API endpoint where you can pass in any number of parameters for an EF core entity. I then want to merge the given parameters/object into the entity to update only those fields.

I'm new to C# and having issues getting this to work. I ended up trying AutoMapper but it is updating all the given fields and setting the rest to null.
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
Next page

Similar Threads

Updating Immutable object with ef
C#CC# / help
2y ago
Updating/Deleting owned properties with EF Core and AutoMapper
C#CC# / help
13mo ago
Calculated Properties with EF Core
C#CC# / help
2y ago
EF Core: Keep Copy of Entity with old state when updating
C#CC# / help
3y ago