Closed Fadi-MAMB closed 3 years ago
It is not something I can fix, pls report in the Pomelo repository.
Workaround is to include all related tables.
Thank you for your quick reply .. will try adding all tables ..
it worked when i included all tables .. thank you for this tool and for your support
Please raise an issue in the Pomelo repository. And thanks for the kind words.
Hi .. i'm using this very nice tool with .Net core application
i selected 2 tables, one of them is simple (no relations with other tables and no constraints ) and everything worked fine .. but when i tried the same with another table that has foreign key constraints with many tables (the tables were not included in the selected tables) i got the following error
System.Exception: Reverse engineer error: System.InvalidOperationException: Sequence contains no matching element at System.Linq.ThrowHelper.ThrowNoMatchException() at System.Linq.Enumerable.Single[TSource](IEnumerable
1 source, Func
2 predicate) at Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal.MySqlDatabaseModelFactory.GetConstraints(DbConnection connection, IReadOnlyList1 tables) at Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal.MySqlDatabaseModelFactory.GetTables(DbConnection connection, Func
3 filter) at Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal.MySqlDatabaseModelFactory.Create(DbConnection connection, DatabaseModelFactoryOptions options) at Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal.MySqlDatabaseModelFactory.Create(String connectionString, DatabaseModelFactoryOptions options) at RevEng.Core.ReverseEngineerRunner.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions, Boolean removeNullableBoolDefaults, Boolean excludeNavigations, ServiceProvider serviceProvider) in C:\Code\EFCorePowerTools\src\GUI\RevEng.Core\ReverseEngineerRunner.cs:line 287 at RevEng.Core.ReverseEngineerRunner.GenerateDbContext(ReverseEngineerCommandOptions options, ServiceProvider serviceProvider, IReverseEngineerScaffolder scaffolder, List`1 schemas, String outputContextDir, String modelNamespace, String contextNamespace) in C:\Code\EFCorePowerTools\src\GUI\RevEng.Core\ReverseEngineerRunner.cs:line 170 at RevEng.Core.ReverseEngineerRunner.GenerateFiles(ReverseEngineerCommandOptions options) in C:\Code\EFCorePowerTools\src\GUI\RevEng.Core\ReverseEngineerRunner.cs:line 91 at efreveng.Program.Main(String[] args) in C:\Code\EFCorePowerTools\src\GUI\efreveng\Program.cs:line 57at EFCorePowerTools.Handlers.ReverseEngineer.ResultDeserializer.BuildResult(String output) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineer\ResultDeserializer.cs:line 26 at EFCorePowerTools.Handlers.ReverseEngineer.EfRevEngLauncher.GetOutput() in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineer\EfRevEngLauncher.cs:line 129 at EFCorePowerTools.Handlers.ReverseEngineer.EfRevEngLauncher.LaunchExternalRunner(ReverseEngineerOptions options, Boolean useEFCore5) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineer\EfRevEngLauncher.cs:line 57 at EFCorePowerTools.Handlers.ReverseEngineer.ReverseEngineerHandler.GenerateEfRevEng(Project project, ReverseEngineerOptions options, Tuple`2 containsEfCoreReference) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineer\ReverseEngineerHandler.cs:line 443 at EFCorePowerTools.Handlers.ReverseEngineer.ReverseEngineerHandler.d__5.MoveNext() in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineer\ReverseEngineerHandler.cs:line 154
Further technical details
EF Core Power Tools version: Version 2.5.572.0
SQLite ADO.NET Provider included: 1.0.109.0 SQLite EF6 DbProvider in GAC - No
System.Data.SQLite DDEX provider - No SQLite Simple DDEX provider - Yes
Database engine: MySQL
Visual Studio version: Visual Studio 2019 16.9.2
.Net Core Version : .Net 5
Microsoft.EntityFrameworkCore Version="5.0.4" Microsoft.EntityFrameworkCore.SqlServer Version="5.0.4"
Microsoft.EntityFrameworkCore.SqlServer.Design Version="1.1.6" Microsoft.EntityFrameworkCore.Tools Version="5.0.4" MySql.EntityFrameworkCore Version="5.0.0"
Microsoft.EntityFrameworkCore:
and i also tried it with Pomelo.EntityFrameworkCore.MySql Version "5.0.0-alpha.2"
and i got same error