Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse enginnering scaffolding command fails for EF Core 3 Preview 4 #15502

Closed
AspNetWebDev opened this issue Apr 26, 2019 · 4 comments
Closed

Comments

@AspNetWebDev
Copy link

AspNetWebDev commented Apr 26, 2019

I am using EF Core 3 Preview 4 inside an ASP.NET Core 3 Preview 4 application.

  1. I installed dotnet-ef tool using this command

dotnet tool install --global dotnet-ef --version 3.0.0-preview4.19216.3

  1. I added NuGet packages for Microsoft.EntityFrameworkCore, Microsoft.EntityFrameworkCore.Relational and Microsoft.EntityFrameworkCore.SqlServer

All are version 3.0.0-preview4.19216.3

  1. Then added NuGet package for Microsoft.EntityFrameworkCore.Design

Version = 3.0.0-preview4.19216.3

  1. Then I issue this command at command prompt

dotnet ef dbcontext scaffold "Server=.;Database=MyDb;Integrated Security=true;" Microsoft.EntityFrameworkCore.SqlServer -o Data -c MyDbContext -t MyTable1 -t MyTable2

I get this error :

System.InvalidCastException: Unable to cast object of type 'Microsoft.EntityFram
eworkCore.Diagnostics.RelationalLoggingDefinitions' to type 'Microsoft.EntityFra
meworkCore.SqlServer.Diagnostics.Internal.SqlServerLoggingDefinitions'.
at Microsoft.EntityFrameworkCore.SqlServer.Internal.SqlServerResources.LogFou
ndDefaultSchema(IDiagnosticsLogger logger)
at Microsoft.EntityFrameworkCore.SqlServer.Internal.SqlServerLoggerExtensions
.DefaultSchemaFound(IDiagnosticsLogger1 diagnostics, String schemaName) at Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal.SqlServerData baseModelFactory.GetDefaultSchema(DbConnection connection) at Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal.SqlServerData baseModelFactory.Create(DbConnection connection, DatabaseModelFactoryOptions opt ions) at Microsoft.EntityFrameworkCore.SqlServer.Scaffolding.Internal.SqlServerData baseModelFactory.Create(String connectionString, DatabaseModelFactoryOptions opt ions) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffold er.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions options, S tring rootNamespace, String modelNamespace, String contextNamespace, String lang uage, String contextDir, String contextName, ModelReverseEngineerOptions modelOp tions, ModelCodeGenerationOptions codeOptions) at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldC ontext(String provider, String connectionString, String outputDir, String output ContextDir, String dbContextClassName, IEnumerable1 schemas, IEnumerable1 tabl es, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames ) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl (String provider, String connectionString, String outputDir, String outputDbCont extDir, String dbContextClassName, IEnumerable1 schemaFilters, IEnumerable1 ta bleFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatab aseNames) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c __DisplayClass0_1.<.ctor>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__ DisplayClass3_01.b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execu
te(Action action)
Unable to cast object of type 'Microsoft.EntityFrameworkCore.Diagnostics.Relatio
nalLoggingDefinitions' to type 'Microsoft.EntityFrameworkCore.SqlServer.Diagnost
ics.Internal.SqlServerLoggingDefinitions'.

What might be the problem ??

Thank you.

@roji
Copy link
Member

roji commented Apr 26, 2019

Duplicate of #15414

@roji roji marked this as a duplicate of #15414 Apr 26, 2019
@roji roji closed this as completed Apr 26, 2019
@ajcvickers
Copy link
Member

@roji Thanks for taking care of closing this. Can you also add a closed-duplicate tag next time?

@roji
Copy link
Member

roji commented Apr 30, 2019

Sorry, am still learning the ropes it seems...

@ajcvickers
Copy link
Member

@roji No need to apologize. :-)

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants