'EF Scaffold table name is null
I'm trying to reverse engineer a Firebird 3 database using dotnet-ef scaffold. I tried it using EF Core 5 and EF Core 6. Both do not work but for different reasons. EF Core 5 is preferred because I'm currently not able to update everything to net6.0.
The command I'm trying to execute:
dotnet-ef dbcontext scaffold "..." "FirebirdSql.EntityFrameworkCore.Firebird" -o "C:\Dev\...\Database\Models\Caps" --context-dir "C:\Dev\...\Database\Contexts" -n "Database.Models.Caps" --context-namespace "Database.Contexts" -c "CapsDbContext" --no-onconfiguring --no-build
EF Core: 5.0.14
EF Firebird: 8.5.4
Error:
System.ArgumentNullException: Value cannot be null. (Parameter 'name')
at Microsoft.EntityFrameworkCore.Utilities.Check.NotNull[T](T value, String parameterName)
at Microsoft.EntityFrameworkCore.Metadata.StoreObjectIdentifier.Table(String name, String schema)
at Microsoft.EntityFrameworkCore.RelationalKeyExtensions.GetName(IKey key)
at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.GenerateKey(IKey key, IEntityType entityType, Boolean useDataAnnotations, IndentedStringBuilder sb)
at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.GenerateEntityType(IEntityType entityType, Boolean useDataAnnotations, IndentedStringBuilder sb)
at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.GenerateOnModelCreating(IModel model, Boolean useDataAnnotations)
at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.GenerateClass(IModel model, String contextName, String connectionString, Boolean useDataAnnotations, Boolean suppressConnectionStringWarning, Boolean suppressOnConfiguring)
at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpDbContextGenerator.WriteCode(IModel model, String contextName, String connectionString, String contextNamespace, String modelNamespace, Boolean useDataAnnotations, Boolean suppressConnectionStringWarning, Boolean suppressOnConfiguring)
at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpModelGenerator.GenerateModel(IModel model, ModelCodeGenerationOptions options)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluarlize)
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)
Value cannot be null. (Parameter 'name')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
