-
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
Allow different types for FK/PK if a value converters to compatible provider types are used #22542
Comments
Note for triage: this fails because the type of the FK is Model (EF Core 5.0):
|
I there any possibility to modify the special handling nullable FK against non-nullable PK? |
@alc86 I am not aware of any way to make this work. |
Related to #13850 |
We use a custom ValueConverter to map our Undefinable type into the database relevant type. This works as expected as long as TValue is not a reference or nullable type.
Currently EF Core generates two database columns for every reference or nullable type one is our defined and there is an additional shadow foreign key property.
Steps to reproduce
We have an Undefinable struct which tells us if the client provide a value for a property
Using this ValueConverter EF Core uses the correct database type. (This works as expected as long as TValue is not a reference or nullable type)
Look at the following relationsship
At the DBContext we use the following snippet to add the UndefinableConverter
EF Core creates a migration with two columns for the Person AddressId:
Further technical details
EF Core version: 3.1.7
Database provider: Npgsql.EntityFrameworkCore.PostgreSQL (3.1.4)
Target framework: .NET Core 3.1
IDE: Visual Studio 2019 16.3
The text was updated successfully, but these errors were encountered: