Describe what is not working as expected.
I use Scaffold command to generate C# db entity.It works in dotnet core 2.2,but throw error in dotnet 3.0.100-preview8-013656(also update depend nuget package).
PM> Scaffold-DbContext -Force "Data Source=xx;Database=cloud;User Id=xx;Password=xx;CharSet=utf8;port=xx" MySql.Data.EntityFrameworkCore -OutputDir Models -Context MySqlContext
System.TypeLoadException: Method 'Create' in type 'MySql.Data.EntityFrameworkCore.Scaffolding.Internal.MySQLDatabaseModelFactory' from assembly 'MySql.Data.EntityFrameworkCore, Version=8.0.17.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' does not have an implementation.
at MySql.Data.EntityFrameworkCore.Design.Internal.MySQLDesignTimeServices.ConfigureDesignTimeServices(IServiceCollection serviceCollection)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.ConfigureDesignTimeServices(Type designTimeServicesType, IServiceCollection services)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.ConfigureProviderServices(String provider, IServiceCollection services, Boolean throwOnError)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.Build(String provider)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, 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 outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.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)
Method 'Create' in type 'MySql.Data.EntityFrameworkCore.Scaffolding.Internal.MySQLDatabaseModelFactory' from assembly 'MySql.Data.EntityFrameworkCore, Version=8.0.17.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' does not have an implementation.
PM> Scaffold-DbContext -Force "Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = xx)(PORT=xx))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME =xx)));User Id=xx;Password=xx;" Oracle.EntityFrameworkCore -OutputDir DataModels -Context MyDbContext -Schemas xx
System.TypeLoadException: Method 'Create' in type 'Oracle.EntityFrameworkCore.Scaffolding.Internal.OracleDatabaseModelFactory' from assembly 'Oracle.EntityFrameworkCore, Version=2.0.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342' does not have an implementation.
at Oracle.EntityFrameworkCore.Design.Internal.OracleDesignTimeServices.ConfigureDesignTimeServices(IServiceCollection serviceCollection)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.ConfigureDesignTimeServices(Type designTimeServicesType, IServiceCollection services)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.ConfigureProviderServices(String provider, IServiceCollection services, Boolean throwOnError)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.Build(String provider)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, 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 outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.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)
Method 'Create' in type 'Oracle.EntityFrameworkCore.Scaffolding.Internal.OracleDatabaseModelFactory' from assembly 'Oracle.EntityFrameworkCore, Version=2.0.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342' does not have an implementation.
Include a complete code listing (or project/solution) that we can run to reproduce the issue.
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
c#
--mysql (replace sensitive information to xx)
Scaffold-DbContext -Force "Data Source=xx;Database=cloud;User Id=xx;Password=xx;CharSet=utf8;port=xx" MySql.Data.EntityFrameworkCore -OutputDir Models -Context MySqlContext
--oracle (replace sensitive information to xx)
Scaffold-DbContext -Force "Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = xx)(PORT=xx))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME =xx)));User Id=xx;Password=xx;" Oracle.EntityFrameworkCore -OutputDir DataModels -Context MyDbContext -Schemas xx
$ dotnet --info
.NET Core SDK (global.json):
Version: 3.0.100-preview8-013656
Commit: 8bf06ffc8d
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:Program Filesdotnetsdk3.0.100-preview8-013656
Host (useful for support):
Version: 3.0.0-preview8-28405-07
Commit: d01b2fb7bc
.NET Core SDKs installed:
2.1.801 [C:Program Filesdotnetsdk]
2.2.300 [C:Program Filesdotnetsdk]
2.2.401 [C:Program Filesdotnetsdk]
3.0.100-preview8-013656 [C:Program Filesdotnetsdk]
IDE: (Visual Studio Community 2019 16.2.3)
<PackageReference Include="Autofac" Version="4.9.4" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="5.0.0-rc1" />
<PackageReference Include="AutoMapper" Version="9.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Dapper" Version="2.0.4" />
<PackageReference Include="log4net" Version="2.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0-preview8.19405.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0-preview8.19405.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0-preview8.19405.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0-preview8.19405.11"/>
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="3.0.0-preview8.19405.4" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0-preview8.19405.4" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0-preview8-19413-06" />
<PackageReference Include="MySql.Data" Version="8.0.17" />
<PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.17" />
<PackageReference Include="MySql.Data.EntityFrameworkCore.Design" Version="8.0.17" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3-beta1" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="2.19.30" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="2.19.31" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc2" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="5.0.0-rc8" />
@dreign As far as I know, there isn't a MySQL provider for EF Core that has been updated to work with 3.0 release. We have plans to help update the open-source Pomelo provider, although this probably won't happen until after 3.0 ships--see #797.
You will need to contact Oracle for information on the official provider, although many people in the past seem to have had better luck with the Pomelo provider.
thank you it works well with:
dotnet 3.1.101;
NuGet packages :
Pomelo.EntityFrameworkCore.MySql v3.1.1
Pomelo.EntityFrameworkCore.MySql.Design V1.12
Microsoft.EntityFrameworkCore.Tools v3.1.2
For a Web MVC Application asp. net Core and Mysql 8.0.19 and a 8.0.19 .NET Connector
For mysql (replace sensitive information to xx)
Packet Manager command line:
PM>Scaffold-DbContext -Force "server=xx;Database=xx;User Id=xx;Password=xx;CharSet=utf8;port=xx" Pomelo.EntityFrameworkCore.MySql -OutputDir Models -Context MySqlContext
Most helpful comment
thank you it works well with:
dotnet 3.1.101;
NuGet packages :
Pomelo.EntityFrameworkCore.MySql v3.1.1
Pomelo.EntityFrameworkCore.MySql.Design V1.12
Microsoft.EntityFrameworkCore.Tools v3.1.2
For a Web MVC Application asp. net Core and Mysql 8.0.19 and a 8.0.19 .NET Connector
For mysql (replace sensitive information to xx)
Packet Manager command line:
PM>Scaffold-DbContext -Force "server=xx;Database=xx;User Id=xx;Password=xx;CharSet=utf8;port=xx" Pomelo.EntityFrameworkCore.MySql -OutputDir Models -Context MySqlContext