© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
2 replies
SWEETPONY

Error: The value of shadow key property 'ResourceDemandChunks.Id' is unknown when attempting to save

Hey everyone! I'm stuck with this problem: The value of shadow key property 'ResourceDemandChunks.Id' is unknown when attempting to save changes. This is because shadow property values cannot be preserved when the entity is not being tracked. Consider adding the property to the entity's .NET type

this is how I register entity in db context:
 modelBuilder.Entity<WorkingTaskEntity>().OwnsOne(c => c.CustomData, t =>  
 {
     t.ToJson();
     t.OwnsMany(customData => customData.ResourceDemandChunks);
 }); 
 modelBuilder.Entity<WorkingTaskEntity>().OwnsOne(c => c.CustomData, t =>  
 {
     t.ToJson();
     t.OwnsMany(customData => customData.ResourceDemandChunks);
 }); 


CustomData
CustomData
is jsonb property, in DDL it is jsonb, I absolutely no idea what happening..
public WorkingTaskData? CustomData { get; init; }
public record WorkingTaskData 
{
   public List<ResourceDemandChunks> ResourceDemandChunks { get; set; }
public WorkingTaskData? CustomData { get; init; }
public record WorkingTaskData 
{
   public List<ResourceDemandChunks> ResourceDemandChunks { get; set; }
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

Foreign Key Exception on Id when attempting to insert
C#CC# / help
2y ago
Shadow property, but property is defined?
C#CC# / help
3y ago
❔ The foreign key property 'UserRole.RoleId1' was created in shadow state
C#CC# / help
4y ago