This post lists a number of known issues you may encounter with Entity Framework Core Power Tools SQL Server reverse engineering or when running the
dotnet ef dbcontext scaffold command, and provides resolutions / workarounds for the issue.
Timeouts with GetIndexes method when reverse engineering database with many indexes
If you have a SQL Server database with many thousands of index columns, you may see timeout errors with the EF Core command line tools.
- Use EF Core Power Tools, which contains the fix in this PR, which may be included in EF Core 6.0.
- Try updating statistics on the sys tables
- Try clearing the procedure cache with
- Wait for the release of Microsoft.Data.SqlClient 2.1.0-preview2, take a direct dependency on this version, and add "Command Timeout=300" to your connection string
SQL Server default values and computed column definitions are missing in the generated code
Expected values for HasDefaultValueSql and HasComputedColumnSql are not generated, this is caused by the account running the scaffolding commands having limited rights to view definitions, as designed.
- Use EF Core Power Tools, and be warned if the user account used for scaffolding does not have the required rights.
- Grant the required rights to the user account used -
GRANT VIEW DEFINITION to limited_user;
Cannot scaffold tables with blank column names
SQL Server allows blank column names in tables, but this causes the following error when scaffolding:
The string argument 'originalIdentifier' cannot be empty.
- Use EF Core Power Tools, which contains a fix for this. (Fix will also be in EF Core 6.0)
- Rename the column :-)
When using the EF Core 5 command line tools, pluralization is suddenly enabled
With EF Core 5.0, pluralization using the Humanizer library is enabled by default. This causes unexpected name changes if you use EF Core 5.0 scaffolding on an upgraded project.
To revert to the previous behavior, use the new
--no-pluralize (dotnet) /
-NoPluralize (PMC) command line option
Build warning: RelationalIndexBuilderExtensions.HasName(IndexBuilder, string)' is obsolete
You get the following build warning after upgrading a project with a scaffolded DbContext to EF Core 5.0:
Warning CS0618 'RelationalIndexBuilderExtensions.HasName(IndexBuilder, string)' is obsolete: 'Use HasDatabaseName() instead.
Re-run scaffolding with EF Core 5 tools.
BIT NOT NULL with DEFAULT 1 is generated as bool?
Error message from EF Core Power Tools: Unable to launch 'dotnet' version 3 or newer.
The latest version of EF Core Power Tools relies on the presence of the .NET Core x64 run-time on the developer machine. If the run-time is not installed, you will get the above error message.