Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlLite computed columns #2273

Closed
karenpayneoregon opened this issue Apr 10, 2024 · 5 comments
Closed

SqlLite computed columns #2273

karenpayneoregon opened this issue Apr 10, 2024 · 5 comments
Labels
question Further information is requested

Comments

@karenpayneoregon
Copy link

karenpayneoregon commented Apr 10, 2024

Create a bug report, feature proposal, or ask a question.

NOTICE: A bug report without sufficient technical and repro details and version information WILL BE CLOSED WITHOUT ANY FURTHER ACTION.

Provide steps to reproduce a bug

Please include a complete description of the issue or link to a project that I can run to reproduce the issue.

Provide technical details

Created table in SQLiteStudio v3.4.4

CREATE TABLE ComputedSample(
   Id INTEGER PRIMARY KEY AUTOINCREMENT,
   FirstName TEXT,
   LastName TEXT,
   FullName STRING AS (FirstName || ' ' || LastName) VIRTUAL
);

Project
https://github.com/karenpayneoregon/sql-basics/tree/master/SqlLiteSampleComputedColumns

Added some records, went to reverse engineer and got

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, Nullable`1 stored)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitColumn(EntityTypeBuilder builder, DatabaseColumn column)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitColumns(EntityTypeBuilder builder, ICollection`1 columns)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.VisitTable(ModelBuilder modelBuilder, DatabaseTable table)
   at RevEng.Core.ColumnRemovingScaffoldingModelFactory.VisitTable(ModelBuilder modelBuilder, DatabaseTable table) in C:\Code\Github\EFCorePowerTools\src\Core\RevEng.Core.60\ColumnRemovingScaffoldingModelFactory.cs:line 87
   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 RevEng.Core.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions, Boolean removeNullableBoolDefaults, Boolean excludeNavigations, Boolean dbContextOnly, Boolean entitiesOnly, Boolean useSchemaFolders, Boolean useSchemaNamespaces) in C:\Code\Github\EFCorePowerTools\src\Core\RevEng.Core.60\ReverseEngineerScaffolder.cs:line 488
   at RevEng.Core.ReverseEngineerScaffolder.GenerateDbContext(ReverseEngineerCommandOptions options, List`1 schemas, String outputContextDir, String modelNamespace, String contextNamespace, String projectPath, String outputPath) in C:\Code\Github\EFCorePowerTools\src\Core\RevEng.Core.60\ReverseEngineerScaffolder.cs:line 94
   at RevEng.Core.ReverseEngineerRunner.GenerateFiles(ReverseEngineerCommandOptions options) in C:\Code\Github\EFCorePowerTools\src\Core\RevEng.Core.60\ReverseEngineerRunner.cs:line 86
  • EF Core Power Tools version: (found in About dialog - blue questionmark icon on context menu)

2.6.200

  • Exact Visual Studio version: (e.g. Visual Studio 2022 17.6.5)

17.9.2

  • Database engine: (SQL Server, Azure SQL, Postgres, Oracle, Firebird, SQLite, MySQL)

SQLite

  • EF Core version in use: (e.g. EF Core 7)

EF CORE 8

  • Is Handlebars templates used: no/yes

No

  • Is T4 templates used: no/yes

No

  • Is a SQL Server .dacpac used: no/yes

Not

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 10, 2024

Thanks, looks like a bug in the Sqlite EF Core provider.

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 11, 2024

@karenpayneoregon have you logged an issue in the EF Core repo?

@ErikEJ ErikEJ added the question Further information is requested label Apr 11, 2024
@ErikEJ
Copy link
Owner

ErikEJ commented Apr 12, 2024

Ping?

@karenpayneoregon
Copy link
Author

No I have not, did not realize I needed to but if that is the case will do so tonight.

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 12, 2024

It was fixed for EF Core! dotnet/efcore#32179

@ErikEJ ErikEJ closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants