Skip to content

Commit a5aa9b8

Browse files
Fix some markdown language syntax highlights (#26680)
1 parent 24934fa commit a5aa9b8

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

docs/security.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,21 @@ Any values supplied in a LINQ query will be appropriately parameterized or escap
118118

119119
For example, the following method looks up customers with a given last name in the database.
120120

121-
```
121+
```cs
122122
public IEnumerable<Customer> FindCustomers(string lastName)
123123
{
124-
using(var context = new CustomerContext())
124+
using (var context = new CustomerContext())
125125
{
126126
var customers = context.Customers
127127
.Where(c => c.LastName == lastName)
128-
.ToList;
128+
.ToList();
129129
}
130130
}
131131
```
132132

133133
The last name value is passed as a parameter because it may come from an end user of the application and be subject to malicious input.
134134

135-
```
135+
```sql
136136
SELECT [c].[CustomerId], [c].[Name]
137137
FROM [Customer] AS [c]
138138
WHERE [c].[LastName] = @p0
@@ -145,10 +145,10 @@ Any values that come from instance data (i.e. values stored in entity properties
145145
**Example**
146146
For example, the following method creates a new customer in the database based on a supplied first and last name.
147147

148-
```
148+
```cs
149149
public Customer CreateCustomer(string firstName, string lastName)
150150
{
151-
using(var context = new CustomerContext())
151+
using (var context = new CustomerContext())
152152
{
153153
var customer = new Customer
154154
{
@@ -166,7 +166,7 @@ public Customer CreateCustomer(string firstName, string lastName)
166166

167167
The names values are passed as a parameter because they may come from an end user of the application and be subject to malicious input.
168168

169-
```
169+
```sql
170170
INSERT INTO [Customer] ([FirstName], [LastName])
171171
OUTPUT INSERTED.[CustomerId]
172172
VALUES (@p0, @p1)
@@ -186,19 +186,19 @@ When using APIs that accept a raw SQL string the API allows values to be easily
186186

187187
For example, the following code makes use of parameters for some end-user supplied strings when executing a raw SQL command against a database. The command is executed by dropping down to the ADO.NET `DbCommand` for the underlying data store.
188188

189-
```
189+
```cs
190190
public void MoveClients(string oldOwner, string newOwner)
191191
{
192-
using (var context = new OrdersContext(str))
192+
using (var context = new OrdersContext())
193193
{
194194
var connection = context.Database.AsRelational().Connection.DbConnection;
195-
var cmd = connection .CreateCommand();
195+
var cmd = connection.CreateCommand();
196196
cmd.CommandText = "UPDATE [dbo].[Customer] SET [Owner] = @p0 WHERE [Owner] = @p1";
197-
cmd.Parameters.Add(new SqlParameter("p0", "newOwner"));
198-
cmd.Parameters.Add(new SqlParameter("p1", "oldOwner"));
199-
connection .Open();
197+
cmd.Parameters.Add(new SqlParameter("p0", newOwner));
198+
cmd.Parameters.Add(new SqlParameter("p1", oldOwner));
199+
connection.Open();
200200
cmd.ExecuteNonQuery();
201-
connection .Close();
201+
connection.Close();
202202
}
203203
}
204204
```

0 commit comments

Comments
 (0)