-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Made it possible to use IEnumerable.Empty() in HasDefaultValue. #18240
Made it possible to use IEnumerable.Empty() in HasDefaultValue. #18240
Conversation
Also added a test for it. Fix dotnet#17780
Please let me know if the bug should be fixed differently. |
src/EFCore.Relational/Extensions/RelationalPropertyExtensions.cs
Outdated
Show resolved
Hide resolved
.Entity<Customer>() | ||
.Property(c => c.Orders) | ||
.HasDefaultValue(Enumerable.Empty<Order>()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an assert to check the default value was set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add a test to ModelSnapshotSqlServerTest
that uses a default value and a value conversion to ensure that the correct value is stored in the snapshot.
Co-Authored-By: Andriy Svyryd <[email protected]>
Closing this for now since there has been no recent activity. To resurrect this for more work, please create a new PR re-based on current master. |
Made it possible to use IEnumerable.Empty() in HasDefaultValue.
Fixes #17780