Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support shadow properties on value type complex types #35337

Open
AndriySvyryd opened this issue Dec 17, 2024 · 0 comments
Open

Support shadow properties on value type complex types #35337

AndriySvyryd opened this issue Dec 17, 2024 · 0 comments

Comments

@AndriySvyryd
Copy link
Member

Currently we don't support shadow properties on value type complex types as they could be a pit of failure. Consider the following case where Address has a shadow Verified property:

var customerEntry1 = context.Entry(customer1);
customerEntry1.ComplexProperty(v => v.Address).Property<bool>("Verified").CurrentValue = true;

customer2.Address = customer1.Address;

What is the value of the Verified property on customer2.Address? If Address was a reference type it would be true, but since it's not EF change tracking doesn't have any way to determine that the shadow property values should be copied, so it will be false.

This behavior is unintuitive and could lead to subtle issues.

This said, we still want to hear whether anyone has a scenario that requires them to use shadow properties on collections or non-collections of value complex types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant