1

Trying to create scaffolding for an already existing MySql database using the instructions at Scaffolding an Existing Database in EF Core

Using EF Core 2.0 and MySQL.DataEntityFrameworkCore{Design} 6.10.6. When I run the following (redacted) command in the in the Package Manager Console:

Scaffold-DbContext "server=111.2.33.44;port=3306;user=xxx;password=yyy;database=zzz" MySql.Data.EntityFrameworkCore  -OutputDir DB -f

which should get me the scaffolding files in DB which is a C# class library.

Instead I get the error:

System.NotImplementedException: The method or operation is not implemented.
   at MySql.Data.EntityFrameworkCore.Scaffolding.Internal.MySQLDatabaseModelFactory.Create(String connectionString, IEnumerable`1 tables, IEnumerable`1 schemas)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.Create(String connectionString, IEnumerable`1 tables, IEnumerable`1 schemas, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ModelScaffolder.Generate(String connectionString, IEnumerable`1 tables, IEnumerable`1 schemas, String projectPath, String outputPath, String rootNamespace, String contextName, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_1.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
The method or operation is not implemented.

The thing is, I'm not trying to create a database, only implement an interface to an already existing database.

What's wrong here?

2
  • 2
    I was able to get the scaffolding by installing Pomelo and running "Scaffold-DbContext "server=111.2.33.44;port=3306;user=xxx;password=yyy;database=zzz" Pomelo.EntityFrameworkCore.MySql -OutputDir DB -f" Commented Feb 21, 2018 at 0:39
  • Possible duplicate of Error: The method or operation is not implemented. while scaffolding MYSQL Database Commented Sep 16, 2019 at 18:12

1 Answer 1

4

The package MySql.Data.EntityFrameworkCore doesn't support scaffolding at the moment I am posting and raises NotImplementedException.

To scaffold the entities from MySQL database you could use the alternative package Pomelo.EntityFrameworkCore.MySql (read Getting Started section about manually adding DotNetCliToolReference to Microsoft.EntityFrameworkCore.Tools.DotNet).

With Pomelo.EntityFrameworkCore.MySql the command for Package Manager Console will look like this:

Scaffold-DbContext "your-mysql-connection-string" Pomelo.EntityFrameworkCore.MySql -OutputDir DB -f
Sign up to request clarification or add additional context in comments.

1 Comment

Right @KevinJohnsrude, just want to make this question answered and provide some more details on how to make this working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.