Search for existing suggestions

For TPT, allow the name of the primary key column in the derived table to be specified via code-first. Needed to handle pre-existing schemas

6 votes
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

Terry Coatta shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Niels Peter Gibe commented  ·   ·  Flag as inappropriate

    I have a similar issue.

    I use CodeFirst to create the database, but the created schema always names the primary keys in a way, where I can't use the tables in a third party legacy system. This system expects, that if the name of a table is "Articles" and the PrimaryKey column is "ArticleNo", then the name of the primary key will be "ART:ArticleNoKey"

    I need to be able to specify the name of a primary key, similar to the way I can set the name of other normal keys. Something like

    modelBuilder<Article>().HasKey(p => p.ArticleNo).IndexNameOverride("ART:ArticleNoKey");

    or

    modelBuilder<Article>().HasKey(p => p.ArticleNo).Name("ART:ArticleNoKey");

Feedback and Knowledge Base