You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NOTE: I've already requested help from Erik, the author of EF Core Power Tools. He closed my ticket (with no additional help) and sent me here.
I am trying something that appears very straight-forward, but am getting stuck. Maybe I'm not using the correct process?
High-level description: I have an existing DB with two tables and a single SP. I can reverse engineer the DB using EFPowerTools and operation completes without issue. However, if I then try to scaffold a new page based on one of the created Models, I get an error: "Error - There was an error running the selected code generator: 'Could not get the reflection type for DbContext : EFPowerToolsDemo.Data.DemoDbContext' ". I'm not sure how to proceed. Full details are below.
Provide steps to reproduce a bug
Created new project using "ASP.NET Core Web App (Razor Pages) template. Using .Net 8.0 (LTS) with no authentication type. Built project to verify code. Added "Models" and "Data" folders to root project.
Right-clicked on project name, EF Core Power Tools => Reverse Engineer. Choose the DB and EF Core version of 8.0. Picked the two tables and the SP. Set "EntityTypes path" to Models. Checked "Use DataAnnotation attributes to configure the model". Under Advanced... added Data folder to DbContext path. Click okay, let it run, then built the project to verify all the new code is functional.
Add 'NewPage' folder under Pages. Right-click on the new folder and Add => New Scaffolding Item... and then pick the Razor Pages using Entity Framwork (CRUD) option. Set Model class to generated model. Set DbContext class to generated context. Hit "add" and code creation starts, but error is thrown during process that ends the operation.
Error - There was an error running the selected code generator: 'Could not get the reflection type for DbContext : EFPowerToolsDemo.Data.DemoDbContext'
Provide technical details
EF Core Power Tools version: 2.6.72
Exact Visual Studio version: Microsoft Visual Studio Professional 2022 (64-bit) - Current, Version 17.8.5
Database engine: SQL Server Enterprise (GA)
EF Core version in use: EF Core 8
I tried this from scratch twice to make sure I didn't miss anything.
The text was updated successfully, but these errors were encountered:
Add 'NewPage' folder under Pages. Right-click on the new folder and Add => New Scaffolding Item... and then pick the Razor Pages using Entity Framwork (CRUD) option. Set Model class to generated model. Set DbContext class to generated context.
I thought it might be due to an issue with the primary keys in the two tables that I'm accessing, but after some testing this morning it appears that the keys are not the issue.
FWIW, I get a slightly different error if I try the same scaffolding after running Reverse Engineer but without including the stored procedure: There was an error running the selected code generator: 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`[EFPowerToolsDemo.Demo.DemoDbContext]' while attempting to activate 'EFPowerToolsDemo.Data.DemoDbContext'.'
Catfang
changed the title
Can't get CRUD scaffolding to work after running Reverse Engineer from EF Core Power Tools, get reflection error
Can't get CRUD scaffolding to work after running Reverse Engineer from EF Core Power Tools, throws breaking error
Jan 23, 2024
NOTE: I've already requested help from Erik, the author of EF Core Power Tools. He closed my ticket (with no additional help) and sent me here.
I am trying something that appears very straight-forward, but am getting stuck. Maybe I'm not using the correct process?
High-level description: I have an existing DB with two tables and a single SP. I can reverse engineer the DB using EFPowerTools and operation completes without issue. However, if I then try to scaffold a new page based on one of the created Models, I get an error: "Error - There was an error running the selected code generator: 'Could not get the reflection type for DbContext : EFPowerToolsDemo.Data.DemoDbContext' ". I'm not sure how to proceed. Full details are below.
Provide steps to reproduce a bug
Provide technical details
EF Core Power Tools version: 2.6.72
Exact Visual Studio version: Microsoft Visual Studio Professional 2022 (64-bit) - Current, Version 17.8.5
Database engine: SQL Server Enterprise (GA)
EF Core version in use: EF Core 8
I tried this from scratch twice to make sure I didn't miss anything.
The text was updated successfully, but these errors were encountered: