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

Fix sample code in SQL querying page #4920

Merged
merged 1 commit into from
Jan 3, 2025
Merged

Fix sample code in SQL querying page #4920

merged 1 commit into from
Jan 3, 2025

Conversation

roji
Copy link
Member

@roji roji commented Jan 3, 2025

Our conceptual docs generally show SQL Server code, but the samples are designed to work against Sqlite (so they can run out of the box). Inlined sample code into the SQL querying page, which seems to be our general direction anyway.

Fixes #4919

@roji roji requested review from a team and Copilot January 3, 2025 12:39
@roji roji enabled auto-merge (squash) January 3, 2025 12:40

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (8)

samples/core/Querying/SqlQueries/Program.cs:53

  • The 'dbo.' prefix is specific to SQL Server and should be removed or replaced with the appropriate SQLite syntax.
.FromSql($"SELECT * FROM dbo.Blogs")

samples/core/Querying/SqlQueries/Program.cs:60

  • The 'dbo.' prefix is specific to SQL Server and should be removed or replaced with the appropriate SQLite syntax.
.FromSql($"EXECUTE dbo.GetMostPopularBlogs")

samples/core/Querying/SqlQueries/Program.cs:69

  • The 'dbo.' prefix is specific to SQL Server and should be removed or replaced with the appropriate SQLite syntax.
.FromSql($"EXECUTE dbo.GetMostPopularBlogsForUser {user}")

samples/core/Querying/SqlQueries/Program.cs:78

  • The 'dbo.' prefix is specific to SQL Server and should be removed or replaced with the appropriate SQLite syntax.
.FromSql($"EXECUTE dbo.GetMostPopularBlogsForUser @filterByUser={user}")

samples/core/Querying/SqlQueries/Program.cs:87

  • The 'dbo.' prefix is specific to SQL Server and should be removed or replaced with the appropriate SQLite syntax.
.FromSql($"EXECUTE dbo.GetMostPopularBlogsForUser {user}")

samples/core/Querying/SqlQueries/Program.cs:106

  • The 'dbo.' prefix is specific to SQL Server and should be removed or replaced with the appropriate SQLite syntax.
.FromSql($"SELECT * FROM dbo.SearchBlogs({searchTerm})")

samples/core/Querying/SqlQueries/Program.cs:117

  • The 'dbo.' prefix is specific to SQL Server and should be removed or replaced with the appropriate SQLite syntax.
.FromSql($"SELECT * FROM dbo.SearchBlogs({searchTerm})")

samples/core/Querying/SqlQueries/Program.cs:127

  • The 'dbo.' prefix is specific to SQL Server and should be removed or replaced with the appropriate SQLite syntax.
.FromSql($"SELECT * FROM dbo.SearchBlogs({searchTerm})")
@AndriySvyryd
Copy link
Member

Inlined sample code into the SQL querying page, which seems to be our general direction anyway.

The general direction is to keep them in projects, so that they can be run to ensure that they are still working.

@@ -49,128 +50,104 @@ from [Post] as [p]

using (var context = new BloggingContext())
{
#region FromSql
Copy link
Member

Choose a reason for hiding this comment

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

Remove this file if it's no longer being referenced.

Copy link
Member Author

Choose a reason for hiding this comment

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

@roji roji merged commit a7a830a into dotnet:main Jan 3, 2025
4 checks passed
@roji roji deleted the SampleBegone branch January 3, 2025 19:11
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.

SqlParameter doesn't work for FromSqlRaw
2 participants