Skip to content

SQL Server DB is automatically created - #4

Merged
Schullz merged 9 commits into
26.1.3+from
db-checks
Sep 11, 2026
Merged

Schullz merged 9 commits into
26.1.3+from
db-checks

Conversation

@Schullz

@Schullz Schullz commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator
  • Removed " (or the database file)" from the text - its's incorrect, SQLite db file is automatically created before that
  • Unified DB type check
  • Table existence is checked without try/catch

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The SQL Server generator hard-codes the database name in the script (duplicating configuration) and can drift from the configured connection string, leading to broken generation in common configuration changes.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates the sample’s data-generation and provider-detection flow so SQL Server databases can be created automatically and table existence can be checked deterministically (without relying on exception handling), while also aligning user-facing text.

Changes:

  • Adds SQL Server database creation logic to the generator script and updates the default SQL Server connection string database.
  • Refactors provider detection to use a unified enum-based approach derived from EF Core’s provider name.
  • Replaces try/catch-based existence checks with explicit “can connect + table exists” checks and updates UI text accordingly.
File summaries
File Description
README.md Fixes a typo and (should) keep documentation consistent with updated “table not found” messaging.
CS/PivotTableBindToData/SalesDb/Scripts/SqlServerDbGenerator.sql Creates the SQL Server database if missing before (re)creating/populating the Sales table.
CS/PivotTableBindToData/SalesDb/SalesDataGenerator.cs Implements provider detection, explicit DB/table existence checks, and SQL Server batch execution via SqlClient.
CS/PivotTableBindToData/SalesDb/DataProviders.cs Adds EF provider-name → enum mapping helper.
CS/PivotTableBindToData/Program.cs Reads DataProvider as an enum and simplifies provider branching.
CS/PivotTableBindToData/Pages/Index.razor Removes incorrect “database file” wording and updates generation call signature.
CS/PivotTableBindToData/appsettings.json Updates the default SQL Server database name in the connection string.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CS/PivotTableBindToData/SalesDb/Scripts/SqlServerDbGenerator.sql
Comment thread CS/PivotTableBindToData/SalesDb/SalesDataGenerator.cs
Comment thread CS/PivotTableBindToData/SalesDb/SalesDataGenerator.cs
Comment thread README.md
Co-authored-by: Schullz <6040786+Schullz@users.noreply.github.com>
"DataProvider": "SQLite", // SQLite or SqlServer
"ConnectionStrings": {
"SalesDatabase": "Server=(localdb)\\MSSQLLocalDB;Database=Example;Trusted_Connection=True;"
"SalesDatabase": "Server=(localdb)\\MSSQLLocalDB;Database=DevExpressExampleT1332466;Trusted_Connection=True;"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a name without ticket references

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I changed the DB name. Btw, it was the ID of this example, not an ID of an unrelated ticket

@Schullz
Schullz merged commit e79ac9c into 26.1.3+ Sep 11, 2026
2 checks passed
@Schullz
Schullz deleted the db-checks branch September 11, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants