Skip to content

dotnet ef dbcontext scaffold doesn't respect -d option #26687

@saxmaster79

Description

@saxmaster79

Include your code

dotnet ef dbcontext scaffold "Server=myserver;Database=mydb;Trusted_Connection=True;User ID=xyz;Password=123;Integrated Security=False;" Microsoft.EntityFrameworkCore.SqlServer -d --context "ReportsContext" -o "Model/Reports" -f -t Table1 -t Table2

Result: Fluent API is used to configure the model instead of attributes.

This works:

dotnet ef dbcontext scaffold "Server=myserver;Database=mydb;Trusted_Connection=True;User ID=xyz;Password=123;Integrated Security=False;" Microsoft.EntityFrameworkCore.SqlServer --data-annotations --context "ReportsContext" -o "Model/Reports" -f -t Table1 -t Table2

Result: Works as expected. Attributes are used to configure the model.

Include provider and version information

EF Core version: Entity Framework Core .NET Command-line Tools 6.0.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6.0
Operating system: Windows 10
IDE: Command line

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions