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

.net-core database-first entity-framework-core scaffold

Question

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
1
12/6/2018 9:54:48 PM

Accepted Answer

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

-UseDatabaseNames

not

—use-database-names
1
12/6/2018 10:22:14 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow