Share via

EF Core Database-First: Entity Names are Incorrect

Sonya Nadesan 20 Reputation points
2024-11-13T16:05:05.6866667+00:00

We have a table called IntrbankCurves.

When scaffolding, an entity class is created with the name InterbankCurf.

This is the command I am using:

Scaffold-DbContext "Data Source=ExampleSource;Initial Catalog=ExampleDB;Integrated Security=SSPI;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir ExampleDir -ContextDir DbContext -Context ExampleContext -ContextNamespace Example.Context -UseDatabaseNames -Force

Developer technologies | .NET | Entity Framework Core
0 comments No comments

Answer accepted by question author

Anonymous
2024-11-14T05:55:22.2466667+00:00

Hi,@Sonya Nadesan. Welcome to Microsoft Q&A.

You could use -NoPluralize, the full command.

Scaffold-DbContext "Data Source=ExampleSource;Initial Catalog=ExampleDB;Integrated Security=SSPI;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir ExampleDir -ContextDir DbContext -Context ExampleContext -ContextNamespace Example.Context -UseDatabaseNames -Force -NoPluralize

If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.