Skip to content

Commit 0ac3574

Browse files
committed
Merge pull request #42 from benaadams/patch-5
OrdinalIgnoreCase is unnecessary
2 parents 9c28d87 + 12a2689 commit 0ac3574

11 files changed

+11
-32
lines changed

src/Benchmarks/FortunesDapperMiddleware.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ public FortunesDapperMiddleware(RequestDelegate next, string connectionString, D
3030

3131
public async Task Invoke(HttpContext httpContext, HtmlEncoder htmlEncoder)
3232
{
33-
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
34-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
35-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
33+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
3634
{
3735
var rows = await LoadRows(_connectionString, _dbProviderFactory);
3836

src/Benchmarks/FortunesEfMiddleware.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ public FortunesEfMiddleware(RequestDelegate next)
2525

2626
public async Task Invoke(HttpContext httpContext, HtmlEncoder htmlEncoder)
2727
{
28-
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
29-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
30-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
28+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
3129
{
3230
var db = (ApplicationDbContext)httpContext.RequestServices.GetService(typeof(ApplicationDbContext));
3331
db.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;

src/Benchmarks/FortunesRawMiddleware.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ public FortunesRawMiddleware(RequestDelegate next, string connectionString, DbPr
3030

3131
public async Task Invoke(HttpContext httpContext, HtmlEncoder htmlEncoder)
3232
{
33-
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
34-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
35-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
33+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
3634
{
3735
var rows = await LoadRows(_connectionString, _dbProviderFactory);
3836

src/Benchmarks/JsonMiddleware.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ public JsonMiddleware(RequestDelegate next)
2626

2727
public Task Invoke(HttpContext httpContext)
2828
{
29-
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
30-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
31-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
29+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
3230
{
3331
httpContext.Response.StatusCode = 200;
3432
httpContext.Response.ContentType = "application/json";

src/Benchmarks/MultipleQueriesDapperMiddleware.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public MultipleQueriesDapperMiddleware(RequestDelegate next, string connectionSt
3636
public async Task Invoke(HttpContext httpContext)
3737
{
3838
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
39-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
40-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
39+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
4140
{
4241
var count = GetQueryCount(httpContext);
4342
var rows = await LoadRows(count, _connectionString, _dbProviderFactory);

src/Benchmarks/MultipleQueriesEfMiddleware.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ public MultipleQueriesEfMiddleware(RequestDelegate next)
2929

3030
public async Task Invoke(HttpContext httpContext)
3131
{
32-
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
33-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
34-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
32+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
3533
{
3634
var db = (ApplicationDbContext)httpContext.RequestServices.GetService(typeof(ApplicationDbContext));
3735
db.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;

src/Benchmarks/MultipleQueriesRawMiddleware.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public MultipleQueriesRawMiddleware(RequestDelegate next, string connectionStrin
3535

3636
public async Task Invoke(HttpContext httpContext)
3737
{
38-
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
39-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
40-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
38+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
4139
{
4240
var count = GetQueryCount(httpContext);
4341
var rows = await LoadRows(count, _connectionString, _dbProviderFactory);

src/Benchmarks/PlaintextMiddleware.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ public PlaintextMiddleware(RequestDelegate next)
2323

2424
public Task Invoke(HttpContext httpContext)
2525
{
26-
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
27-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
28-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
26+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
2927
{
3028
httpContext.Response.StatusCode = 200;
3129
httpContext.Response.ContentType = "text/plain";

src/Benchmarks/SingleQueryDapperMiddleware.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ public SingleQueryDapperMiddleware(RequestDelegate next, string connectionString
3636

3737
public async Task Invoke(HttpContext httpContext)
3838
{
39-
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
40-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
41-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
39+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
4240
{
4341
var row = await LoadRow(_connectionString, _dbProviderFactory);
4442

src/Benchmarks/SingleQueryEfMiddleware.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ public SingleQueryEfMiddleware(RequestDelegate next)
2929

3030
public async Task Invoke(HttpContext httpContext)
3131
{
32-
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
33-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
34-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
32+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
3533
{
3634
var db = (ApplicationDbContext)httpContext.RequestServices.GetService(typeof(ApplicationDbContext));
3735

src/Benchmarks/SingleQueryRawMiddleware.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public SingleQueryRawMiddleware(RequestDelegate next, string connectionString, D
3535

3636
public async Task Invoke(HttpContext httpContext)
3737
{
38-
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
39-
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
40-
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
38+
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
4139
{
4240
var row = await LoadRow(_connectionString, _dbProviderFactory);
4341

0 commit comments

Comments
 (0)