-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
EF Core 7 Reverse Engineer Error #1523
Comments
Are you using the T4 templates. Try to rename / delete the CodeTemplates folder. |
Ping? |
from what i can tell, i am not using T4 templates. i have a working model if generated using the EF6 option, this error comes from the EF7 preview option when reverse engineering. i don't see a codeTemplates folder to remove. I'm using EF Core Power Tools 2.5.1142.0 on VS 2022 |
I am unable to repro locally, can you share the database schema, for example via a .dacpac and your efpt.config.json file? |
I've removed the tables, but there are tables in 3 different schemas, as well as views, functions, and stored procs. object types 0, 1, 2, and 3. { |
I need the database schema (either .sql script or bacpac file) |
I can't send the schema, but i'll see if I can recreate it in a dummy schema in a new project |
this project seems to throw the error for me if i try pointing to the dacpac |
With the same error? I am not able to repro that (.dacpac functionality is currently borken with EF Core 7) |
Alos not able to repro if I publish the database project |
OK, yes, I got a different error from the dacpac, not the same as the original. will tweak the sample project some more to see if I can narrow down the cause. |
Yeah, sorry, but .dacpac support for EF Core 7 is currently pending |
Is there any log or output you can turn on to see what the progress was to see what the last thing was that it was trying to reverse engineer? |
No, once you figure out (or share the full schema privately) I will try to address this with the EF Core team (lack of good error message) |
You could try to use the EF Core 7 command line tool, and run it with verbose logging. |
Any news? |
dbproject.zip |
yes fixing the PK seems to fix it, the .net core 6 implementation does show the warning in the GUI over the table, but processes it fine |
@bricelam potential EF Core 7 issue? |
Could you share the EF 6 warning? |
i just meant that in the GUI of ef Core POwertools there's a warning sign (yellow triangle) on the table that has no PK. but it processes it anyway. |
@aespitia Unable to repro based on your latest .zip file |
Closing as no repro was provided |
I happen to come across the same problem. I have an app which uses some tables that don´t have a primary key. When I do a reverse engineer with Ef Core 6, it works fine and generates the model correctly. But when I choose Ef Core 7 the model generation fails with this error:
I suspect the problem has to do with the tables without primary key because when I remove those tables from the reverse engineer process, it works. |
Digging around, it seems that the problem is related to this and not a Power tools Issue? dotnet/efcore#29516 |
@blogcraft correct. And will be fixed in 7.0.3 |
yay! glad to know this issue helped someone |
Error when reverse engineering a model from an existing DB:
Microsoft SQL Server 2014 12.0.6439.10 (X64)
using EFCore 7 RC1
System.InvalidOperationException: Reverse engineer error:
System.NullReferenceException: Object reference not set to an instance of an object.
at string Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpDbContextGenerator.TransformText()
at string Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpModelGenerator.ProcessTemplate(ITextTransformation transformation)
at ScaffoldedModel Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpModelGenerator.GenerateModel(IModel model, ModelCodeGenerationOptions options)
at ScaffoldedModel RevEng.Core.ReverseEngineerScaffolder.ScaffoldModel(string connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions, bool removeNullableBoolDefaults, bool excludeNavigations, bool dbContextOnly, bool entitiesOnly, bool useSchemaFolders) in C:/Code/Github/EFCorePowerTools/src/GUI/RevEng.Core/ReverseEngineerScaffolder.cs:line 374
at SavedModelFiles RevEng.Core.ReverseEngineerScaffolder.GenerateDbContext(ReverseEngineerCommandOptions options, List schemas, string outputContextDir, string modelNamespace, string contextNamespace) in C:/Code/Github/EFCorePowerTools/src/GUI/RevEng.Core/ReverseEngineerScaffolder.cs:line 99
at ReverseEngineerResult RevEng.Core.ReverseEngineerRunner.GenerateFiles(ReverseEngineerCommandOptions options) in C:/Code/Github/EFCorePowerTools/src/GUI/RevEng.Core/ReverseEngineerRunner.cs:line 93
at int EfReveng.Program.Main(string[] args) in C:/Code/Github/EFCorePowerTools/src/GUI/efreveng/Program.cs:line 68
at ReverseEngineerResult EFCorePowerTools.Handlers.ReverseEngineer.ResultDeserializer.BuildResult(string output)
at async Task EFCorePowerTools.Handlers.ReverseEngineer.EfRevEngLauncher.GetOutputAsync()
at async Task EFCorePowerTools.Handlers.ReverseEngineer.EfRevEngLauncher.LaunchExternalRunnerAsync(ReverseEngineerOptions options, CodeGenerationMode codeGenerationMode, Project project)
at async Task EFCorePowerTools.Handlers.ReverseEngineer.ReverseEngineerHandler.GenerateFilesAsync(Project project, ReverseEngineerOptions options, Tuple<bool, string> containsEfCoreReference)
at async Task EFCorePowerTools.Handlers.ReverseEngineer.ReverseEngineerHandler.ReverseEngineerCodeFirstAsync(Project project, string optionsPath, bool onlyGenerate, bool fromSqlProj)
The text was updated successfully, but these errors were encountered: