-
Notifications
You must be signed in to change notification settings - Fork 241
Bring over a few changes from the TechEmpower repo #266
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,6 @@ | |
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="System.Runtime.Serialization.Primitives" Version="$(CoreFxVersion)" /> | ||
| <PackageReference Include="Dapper" Version="$(DapperVersion)" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(AspNetCoreVersion)" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.ResponseCaching" Version="$(AspNetCoreVersion)" /> | ||
|
|
@@ -17,7 +16,6 @@ | |
| <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="$(AspNetCoreVersion)" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" Version="$(AspNetCoreVersion)" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(AspNetCoreVersion)" /> | ||
| <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="$(AspNetCoreVersion)" PrivateAssets="All" /> | ||
| <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(AspNetCoreVersion)" /> | ||
| <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(AspNetCoreVersion)" /> | ||
| <PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="$(AspNetCoreVersion)" /> | ||
|
|
@@ -31,10 +29,6 @@ | |
| --> | ||
| <PackageReference Include="Npgsql" Version="$(NpgsqlVersion)" /> | ||
| <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlEntityFrameworkCorePostgreSQLVersion)" /> | ||
| <PackageReference Include="System.Runtime.Serialization.Primitives" Version="$(CoreFxVersion)" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you know why this can/should be removed? |
||
| <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.Dotnet" Version="$(AspNetCoreVersion)" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -155,14 +155,14 @@ public static string GetPath(Expression<Func<Scenarios, bool>> scenarioExpressio | |
|
|
||
| public int Enable(string partialName) | ||
| { | ||
| if(string.Equals(partialName, "[default]", StringComparison.OrdinalIgnoreCase)) | ||
| if (string.Equals(partialName, "[default]", StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| EnableDefault(); | ||
| return 2; | ||
| } | ||
|
|
||
| var props = typeof(Scenarios).GetTypeInfo().DeclaredProperties | ||
| .Where(p => string.Equals(partialName, "[all]", StringComparison.OrdinalIgnoreCase) || p.Name.StartsWith(partialName, StringComparison.OrdinalIgnoreCase)) | ||
| .Where(p => string.Equals(partialName, "[all]", StringComparison.OrdinalIgnoreCase) || p.Name.IndexOf(partialName, StringComparison.OrdinalIgnoreCase) >= 0) | ||
|
||
| .ToList(); | ||
|
|
||
| foreach (var p in props) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| // Copyright (c) .NET Foundation. All rights reserved. | ||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
| // Copyright (c) .NET Foundation. All rights reserved. | ||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
@@ -40,7 +40,7 @@ public async Task<World> LoadSingleQueryRow() | |
| async Task<World> ReadSingleRow(DbConnection db) | ||
| { | ||
| return await db.QueryFirstOrDefaultAsync<World>( | ||
| "SELECT id, randomnumber FROM world WHERE Id = @Id", | ||
| "SELECT id, randomnumber FROM world WHERE id = @Id", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this was required for compat with a particular DB or driver, but either way it seems better all-lowercase. |
||
| new { Id = _random.Next(1, 10001) }); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| // Copyright (c) .NET Foundation. All rights reserved. | ||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
| // Copyright (c) .NET Foundation. All rights reserved. | ||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
|
||
| using System; | ||
| using System.Text; | ||
|
|
@@ -16,7 +16,7 @@ public class PlaintextMiddleware | |
| private static readonly byte[] _helloWorldPayload = Encoding.UTF8.GetBytes("Hello, World!"); | ||
|
|
||
| private readonly RequestDelegate _next; | ||
|
|
||
| public PlaintextMiddleware(RequestDelegate next) | ||
| { | ||
| _next = next; | ||
|
|
@@ -37,11 +37,15 @@ public static Task WriteResponse(HttpResponse response) | |
| var payloadLength = _helloWorldPayload.Length; | ||
| response.StatusCode = 200; | ||
| response.ContentType = "text/plain"; | ||
| response.ContentLength = payloadLength; | ||
|
|
||
| // HACK: Setting the Content-Length header manually avoids the cost of serializing the int to a string. | ||
| // This is instead of: httpContext.Response.ContentLength = payloadLength; | ||
| response.Headers["Content-Length"] = "13"; | ||
|
||
|
|
||
| return response.Body.WriteAsync(_helloWorldPayload, 0, payloadLength); | ||
| } | ||
| } | ||
|
|
||
| public static class PlaintextMiddlewareExtensions | ||
| { | ||
| public static IApplicationBuilder UsePlainText(this IApplicationBuilder builder) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why this can/should be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… because databases are automatically created in all cases. No need for
dotnet ef database update, migration management, et cetera.