Revisit navigation naming convention when reverse-engineering composite keys

Open
#16,711 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp
Domain
database

Research direction

The issue names no source files or tests. Start by reproducing database-first scaffolding with composite keys and inspect the generated navigation-property names. Done would require an agreed naming convention or customization mechanism that handles multiple composite-key relationships without collisions.

Written by the indexing model from the issue text.

Description

area-scaffolding customer-reported

I have a database first solution core 2.2.4. Scaffolding does work and it creates a navigation property. The issue I'm having is how the scaffolding names that property. It causes parent table navigation when really it should call it the child table navigation. What if for some reason there was two composite keys. It wouldn't be able to use the same name.

Is there any way to customize the name does it use something from the foreign key description or anything where it would name the navigation property that it automatically creates a little more smartly?

Dominant language
C#
Stars
14.8k
Forks
3.4k
Avg merge
2d 5h
Merged PRs (30d)
134

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/efcore

All issues in dotnet/efcore

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.