EntityFramework Core database first, Scaffold-DbContext A positional parameter cannot be found that accepts argument '--use-database-names' error

Refresh

April 2019

Views

0 time

1

I am trying to create the model from existing DB using EntityFramework Core, database first approach. The model was created, but the table name and column name were changed to C# style. Because I want the model still using exact table name and column name as in the database, so I append the "--use-database-names" in the command line, according to Entity Framework Core tools reference

Following is the command executed in the Package Manager Console:

Scaffold-DbContext "Server=aServer;Database=someDb;Trusted_Connection=True" Microsoft.EntityFrameworkCore.SqlServer -o Models --use-database-names

But I got following error:

Scaffold-DbContext : A positional parameter cannot be found that accepts argument '--use-database-names'. At line:1 char:1

  • Scaffold-DbContext "Server=aServer;Database=someDb;Trusted_Conn ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [Scaffold-DbContext], ParameterBindingException
    • FullyQualifiedErrorId : PositionalParameterNotFound,Scaffold-DbContext

Has anybody encounter this issue? Did I miss something? Thanks in advance!

Following are some basic info of the simple project.

IDE: Visual Studio 2017

Target framework: .NET Core 2.1

Installed NuGet Package:

Microsoft.EntityFrameworkCore.Design(2.2.0)
Microsoft.EntityFrameworkCore.SqlServer(2.2.0)
Microsoft.EntityFrameworkCore.Tools(2.2.0)
Microsoft.EntityFrameworkCore.SqlServer.Design(1.1.6)

1 answers

1

Like in the reference for Package Manager Console mentioned, you have to write:

-UseDatabaseNames

not

—use-database-names