Skip to content

Migrations: MigrationsSqlGenerator fails to find correct property for column #5379

@smitpatel

Description

@smitpatel

FindEntityType function
https://github.com/aspnet/EntityFramework/blob/dev/src/Microsoft.EntityFrameworkCore.Relational/Migrations/MigrationsSqlGenerator.cs#L786
FindProperty function
https://github.com/aspnet/EntityFramework/blob/dev/src/Microsoft.EntityFrameworkCore.Relational/Migrations/MigrationsSqlGenerator.cs#L793

FindEntityType can match with derived entity type also due to same mapped table in database.
Result of FindProperty depends on result of above. If base type is returned then properties in derived type are not found.
This causes Migrations to have no info about IProperty therefore in the absence of ColumnType clr type is used to find mapping which causes loss of information about max length.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions