-
Notifications
You must be signed in to change notification settings - Fork 183
Fix VB type mismatch in DataGrid SQL EF walkthrough and migrate snippets #2151
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
Conversation
…atch Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com>
Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com>
...ay-data-from-a-sql-server-database-in-a-datagrid-control/framework/csharp/MainWindow.xaml.cs
Show resolved
Hide resolved
Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a Visual Basic compilation error in a WPF DataGrid SQL Entity Framework walkthrough and migrates code snippets to the current standard location. The type mismatch occurred because dataEntities.Products returns ObjectSet(Of Product) (not DbSet), but the code attempted to cast it to ObjectQuery(Of Product).
Key changes:
- Fixed VB type mismatch by removing unnecessary intermediate variable and using LINQ directly on the entity set
- Migrated snippets from
~/samples/snippets/to./snippets/walkthrough-display-data-from-a-sql-server-database-in-a-datagrid-control/framework/ - Updated documentation to use modern
:::code:::syntax instead of legacy[!code-...]syntax - Replaced numeric snippet IDs with descriptive identifiers
- Created SDK-style project files targeting .NET Framework 4.8
Reviewed Changes
Copilot reviewed 21 out of 35 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| walkthrough-display-data-from-a-sql-server-database-in-a-datagrid-control.md | Updated snippet references to new location and modern syntax |
| MainWindow.xaml.vb | Fixed type mismatch by removing ObjectQuery cast and using direct LINQ query |
| MainWindow.xaml.cs | Updated import statements and improved LINQ query indentation |
| MainWindow.xaml (C# and VB) | Added complete XAML files with updated snippet markers |
| DataGridSQLExample.csproj/vbproj | Created SDK-style project files for both languages |
| App.xaml, App.Config, Application.xaml | Added supporting application files |
| AdventureWorksModel.edmx, Designer files | Added Entity Framework model files |
| Legacy files | Removed 31 legacy files from old snippet location |
Files not reviewed (4)
- dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DataGrid_SQL_EF_Walkthrough/CS/Properties/Resources.Designer.cs: Language not supported
- dotnet-desktop-guide/samples/snippets/csharp/VS_Snippets_Wpf/DataGrid_SQL_EF_Walkthrough/CS/Properties/Settings.Designer.cs: Language not supported
- dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/DataGrid_SQL_EF_Walkthrough/VB/My Project/Resources.Designer.vb: Language not supported
- dotnet-desktop-guide/samples/snippets/visualbasic/VS_Snippets_Wpf/DataGrid_SQL_EF_Walkthrough/VB/My Project/Settings.Designer.vb: Language not supported
...data-from-a-sql-server-database-in-a-datagrid-control/framework/vb/DataGridSQLExample.vbproj
Show resolved
Hide resolved
BillWagner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM @adegeo
Let's ![]()
Summary
Fixes Visual Basic compilation error where
dataEntities.ProductsreturnsDbSet(Of Product)but code attempted to cast toObjectQuery(Of Product). Migrates code snippets from legacy location to current standard.Fixes #2077
Bug Fix
Before (broken):
After (fixed):
Migration
~/samples/snippets/to./snippets/walkthrough-display-data-from-a-sql-server-database-in-a-datagrid-control/framework/[!code-...]to modern:::code...:::syntax#2) with descriptive identifiers (LoadDataFromDatabase)💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Internal previews