question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: The string argument 'name' cannot be empty when I scaffolding Sqlite database

See original GitHub issue

I have a Sqlite database that has this table:

CREATE TABLE [Mytable](
  [ID] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, 
  [Name] VARCHAR NOT NULL UNIQUE, 
  UNIQUE([Name]));

I am trying to scaffold this database, I am using this command:

Scaffold-DbContext "Filename=Planos.sqlite" Microsoft.EntityFrameworkCore.Sqlite -UseDatabaseNames -OutputDir Entidades

But I get this error:

System.ArgumentException: The string argument 'name' cannot be empty.
   at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName)
   at Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder.HasIndex(String[] propertyNames, String name)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitUniqueConstraint(EntityTypeBuilder builder, DatabaseUniqueConstraint uniqueConstraint)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitUniqueConstraints(EntityTypeBuilder builder, ICollection`1 uniqueConstraints)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitTable(ModelBuilder modelBuilder, DatabaseTable table)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitTables(ModelBuilder modelBuilder, ICollection`1 tables)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitDatabaseModel(ModelBuilder modelBuilder, DatabaseModel databaseModel)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.Create(DatabaseModel databaseModel, ModelReverseEngineerOptions 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)
The string argument 'name' cannot be empty.

Thanks.

Microsoft.Data.Sqlite version: 3.33.0 Target framework: (NET 5.0) Operating system: Windows 10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ajcvickerscommented, Nov 11, 2020

@smitpatel Regression in 5.0?

0reactions
mannokcommented, Nov 30, 2020

Any workaround on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scaffold DbContext The string argument 'sql' cannot be empty
The error I get: System.ArgumentException: The string argument 'sql' cannot be empty. at Microsoft.EntityFrameworkCore.Utilities.Check.
Read more >
Scaffold-DbContext get an error The string argument 'sql ...
Description: I can't scaffold a mysql database in a asp .net core with mysql ... -f Gets an error The string argument 'sql'...
Read more >
Issues Using EF Core Database First to Reverse Engineer ...
SQL Server allows blank column names in tables, but this causes the following error when scaffolding: The string argument 'originalIdentifier' ...
Read more >
Fix For The string argument propertyNames cannot be empty
Today I got the following error when working with Entity Framework Core against a PostgreSQL database:
Read more >
Breaking changes in EF Core 6.0
Complete list of breaking changes introduced in Entity Framework Core 6.0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found