0

This is my database table

CREATE TABLE `File` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` varchar(50) DEFAULT NULL,
  `description` varchar(50) DEFAULT NULL,
  `extension` varchar(50) DEFAULT NULL,
  `path` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
)

The command I use to generate the models:

Scaffold-DbContext "server=..;user id=..;password=..;database=..;sslmode=none;" MySql.Data.EntityFrameworkCore -OutputDir Models -f

The error I get:

System.ArgumentException: The string argument 'sql' cannot be empty.
   at Microsoft.EntityFrameworkCore.Utilities.Check.NullButNotEmpty(String value, String parameterName)
   at Microsoft.EntityFrameworkCore.RelationalPropertyBuilderExtensions.HasComputedColumnSql(PropertyBuilder propertyBuilder, String sql)
   at Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory.VisitColumn(EntityTypeBuilder builder, ColumnModel column)
   at Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory.VisitColumns(EntityTypeBuilder builder, ICollection`1 columns)
   at Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory.VisitTable(ModelBuilder modelBuilder, TableModel table)
   at Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory.VisitTables(ModelBuilder modelBuilder, ICollection`1 tables)
   at Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory.VisitDatabaseModel(ModelBuilder modelBuilder, DatabaseModel databaseModel)
   at Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory.CreateFromDatabaseModel(DatabaseModel databaseModel)
   at MySql.Data.EntityFrameworkCore.Design.Internal.MySQLScaffoldingModelFactory.Create(String connectionString, TableSelectionSet tableSelectionSet)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineeringGenerator.GetMetadataModel(ReverseEngineeringConfiguration configuration)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineeringGenerator.GenerateAsync(ReverseEngineeringConfiguration configuration, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContextAsync(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<ScaffoldContextImpl>d__22.MoveNext()
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass4_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
The string argument 'sql' cannot be empty.

It says the sql argument cannot be empty, but I don't use 'sql' anywhere. What seems to be the problem?

1 Answer 1

1

I've "fixed" the problem by using Pomelo.EntityFrameworkCore.MySql instead of MySql.Data.EntityFrameworkCore

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.