Skip to content

OrdinalIgnoreCase is unnecessary #42

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

Merged
merged 1 commit into from
Jan 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/Benchmarks/FortunesDapperMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ public FortunesDapperMiddleware(RequestDelegate next, string connectionString, D

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

Expand Down
4 changes: 1 addition & 3 deletions src/Benchmarks/FortunesEfMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ public FortunesEfMiddleware(RequestDelegate next)

public async Task Invoke(HttpContext httpContext, HtmlEncoder htmlEncoder)
{
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
{
var db = (ApplicationDbContext)httpContext.RequestServices.GetService(typeof(ApplicationDbContext));
db.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
Expand Down
4 changes: 1 addition & 3 deletions src/Benchmarks/FortunesRawMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ public FortunesRawMiddleware(RequestDelegate next, string connectionString, DbPr

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

Expand Down
4 changes: 1 addition & 3 deletions src/Benchmarks/JsonMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ public JsonMiddleware(RequestDelegate next)

public Task Invoke(HttpContext httpContext)
{
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
{
httpContext.Response.StatusCode = 200;
httpContext.Response.ContentType = "application/json";
Expand Down
3 changes: 1 addition & 2 deletions src/Benchmarks/MultipleQueriesDapperMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public MultipleQueriesDapperMiddleware(RequestDelegate next, string connectionSt
public async Task Invoke(HttpContext httpContext)
{
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
{
var count = GetQueryCount(httpContext);
var rows = await LoadRows(count, _connectionString, _dbProviderFactory);
Expand Down
4 changes: 1 addition & 3 deletions src/Benchmarks/MultipleQueriesEfMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ public MultipleQueriesEfMiddleware(RequestDelegate next)

public async Task Invoke(HttpContext httpContext)
{
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
{
var db = (ApplicationDbContext)httpContext.RequestServices.GetService(typeof(ApplicationDbContext));
db.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
Expand Down
4 changes: 1 addition & 3 deletions src/Benchmarks/MultipleQueriesRawMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ public MultipleQueriesRawMiddleware(RequestDelegate next, string connectionStrin

public async Task Invoke(HttpContext httpContext)
{
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
{
var count = GetQueryCount(httpContext);
var rows = await LoadRows(count, _connectionString, _dbProviderFactory);
Expand Down
4 changes: 1 addition & 3 deletions src/Benchmarks/PlaintextMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ public PlaintextMiddleware(RequestDelegate next)

public Task Invoke(HttpContext httpContext)
{
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
{
httpContext.Response.StatusCode = 200;
httpContext.Response.ContentType = "text/plain";
Expand Down
4 changes: 1 addition & 3 deletions src/Benchmarks/SingleQueryDapperMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public SingleQueryDapperMiddleware(RequestDelegate next, string connectionString

public async Task Invoke(HttpContext httpContext)
{
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
{
var row = await LoadRow(_connectionString, _dbProviderFactory);

Expand Down
4 changes: 1 addition & 3 deletions src/Benchmarks/SingleQueryEfMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ public SingleQueryEfMiddleware(RequestDelegate next)

public async Task Invoke(HttpContext httpContext)
{
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
{
var db = (ApplicationDbContext)httpContext.RequestServices.GetService(typeof(ApplicationDbContext));

Expand Down
4 changes: 1 addition & 3 deletions src/Benchmarks/SingleQueryRawMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ public SingleQueryRawMiddleware(RequestDelegate next, string connectionString, D

public async Task Invoke(HttpContext httpContext)
{
// We check Ordinal explicitly first because it's faster than OrdinalIgnoreCase
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal) ||
httpContext.Request.Path.StartsWithSegments(_path, StringComparison.OrdinalIgnoreCase))
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
{
var row = await LoadRow(_connectionString, _dbProviderFactory);

Expand Down