From f115e1db68bdec7ae260755396318b455739c95f Mon Sep 17 00:00:00 2001 From: Manvydas Date: Tue, 16 Jun 2020 21:11:16 +0300 Subject: [PATCH] Clearly indicate that userSuppliedSearchTerm variable represents parameter for the query (dotnet#20361) Fixes dotnet#20361 --- .../Extensions/RelationalDatabaseFacadeExtensions.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs b/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs index 36760b4975e..d7612702e04 100644 --- a/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs +++ b/src/EFCore.Relational/Extensions/RelationalDatabaseFacadeExtensions.cs @@ -163,7 +163,10 @@ public static int ExecuteSqlRaw( /// attack. You can include parameter place holders in the SQL query string and then supply parameter values as additional /// arguments. Any parameter values you supply will automatically be converted to a DbParameter: /// - /// context.Database.ExecuteSqlInterpolated($"SELECT * FROM [dbo].[SearchBlogs]({userSuppliedSearchTerm})") + /// + /// var userSuppliedSearchTerm = ".NET"; + /// context.Database.ExecuteSqlInterpolated($"SELECT * FROM [dbo].[SearchBlogs]({userSuppliedSearchTerm})") + /// /// /// The for the context. /// The interpolated string representing a SQL query with parameters. @@ -252,7 +255,10 @@ public static int ExecuteSqlRaw( /// attack. You can include parameter place holders in the SQL query string and then supply parameter values as additional /// arguments. Any parameter values you supply will automatically be converted to a DbParameter: /// - /// context.Database.ExecuteSqlInterpolatedAsync($"SELECT * FROM [dbo].[SearchBlogs]({userSuppliedSearchTerm})") + /// + /// var userSuppliedSearchTerm = ".NET"; + /// context.Database.ExecuteSqlInterpolatedAsync($"SELECT * FROM [dbo].[SearchBlogs]({userSuppliedSearchTerm})") + /// /// /// The for the context. /// The interpolated string representing a SQL query with parameters.