Table Splitting Discriminator property should be nullable by default #21612
Labels
area-model-building
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
type-bug
Milestone
I ran into a problem while validating Can_manipulate_entities_sharing_row_independently in TableSplittingTestBase. The test attempts to remove one of the entities ("Engine") from a shared table ("Vehicles"), which really just sets two columns ("Description" and "Engine_Discriminator") to NULL. This fails with our ADO.NET provider, because the
DbParameter.Value
for the discriminator column isDbNull.Value
, butDbParameter.IsNullable
isfalse
.If I'm understanding the Table Splitting feature correctly, the discriminator properties should all be nullable by default. The TypeMappedRelationalParameter.AddParameter implementation creates a new instance of the relational parameter, which inherits IsNullable from property.IsNullable. Eventually this becomes a provider-specific implementation of DbParameter with IsNullable=false.
Please confirm if this is a bug in EF Core, or perhaps in the Functional Test (the Metadata.IsNullable could be set to true for the discriminator), or if I'm mistaken in my understanding of the feature.
Further technical details
EF Core version: 3.1.5
Database provider: the one I'm writing
The text was updated successfully, but these errors were encountered: