Skip to content

[QUESTION] Why is EFCore adding a random 1 to a column name? #15640

@jzabroski

Description

@jzabroski

Describe what is not working as expected.

I'm trying to configure a one-to-one relationship using database-first modeling, and spuriously get exceptions about column names I do not define in my model.

If you are seeing an exception, include the full exceptions details (message and stack trace).

Full stack trace elided, as it is well after the model building process.

Microsoft.EntityFrameworkCore.DbUpdateException : An error occurred while updating the entries. See the inner exception for details.
---- System.Data.SqlClient.SqlException : Invalid column name 'ParentId1'.

Steps to reproduce

I'm not yet sure how to reproduce this, but given that I do not have the phrase "1" anywhere in my code base, it must be generated internally by EF. Related to #15581 , there is more seemingly random/annoying behavior where I can't just tell EFCore "You trust me? ... I do.". I'm hoping @AndriySvyryd knows where in the code and why a magic 1 is getting added. It's super-confusing for me.

Further technical details

EF Core version: 2.2.4
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10 Pro
IDE: Visual Studio 2017 15.9.11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions