Instantly share code, notes, and snippets.

View Benchmark-before.md
BenchmarkDotNet=v0.10.13, OS=Windows 10.0.17134
Intel Core i7-7700HQ CPU 2.80GHz (Kaby Lake), 1 CPU, 8 logical cores and 4 physical cores
.NET Core SDK=2.1.402
  [Host]     : .NET Core 2.1.4 (CoreCLR 4.6.26814.03, CoreFX 4.6.26814.02), 64bit RyuJIT
  Job-OWZBJX : .NET Core 2.1.4 (CoreCLR 4.6.26814.03, CoreFX 4.6.26814.02), 64bit RyuJIT

Runtime=Core  Server=True  Toolchain=.NET Core 2.1  
RunStrategy=Throughput  
View Benchmark-after.md
BenchmarkDotNet=v0.10.13, OS=Windows 10.0.17134
Intel Core i7-7700HQ CPU 2.80GHz (Kaby Lake), 1 CPU, 8 logical cores and 4 physical cores
.NET Core SDK=2.1.402
  [Host]     : .NET Core 2.1.4 (CoreCLR 4.6.26814.03, CoreFX 4.6.26814.02), 64bit RyuJIT
  Job-TONWLE : .NET Core 2.1.4 (CoreCLR 4.6.26814.03, CoreFX 4.6.26814.02), 64bit RyuJIT

Runtime=Core  Server=True  Toolchain=.NET Core 2.1  
RunStrategy=Throughput  
View ConstrainedGenericBenchmark-report-github.md
BenchmarkDotNet=v0.10.13, OS=Windows 10.0.17134
Intel Core i7-7700HQ CPU 2.80GHz (Kaby Lake), 1 CPU, 8 logical cores and 4 physical cores
.NET Core SDK=2.1.402
  [Host]     : .NET Core 2.1.4 (CoreCLR 4.6.26814.03, CoreFX 4.6.26814.02), 64bit RyuJIT
  Job-MCHATR : .NET Core 2.1.4 (CoreCLR 4.6.26814.03, CoreFX 4.6.26814.02), 64bit RyuJIT

Runtime=Core  Server=True  Toolchain=.NET Core 2.1  
RunStrategy=Throughput  
View TimeToFirstServiceBenchmark-report-github-dev.md
BenchmarkDotNet=v0.10.13, OS=macOS 10.13.4 (17E199) [Darwin 17.5.0]
Intel Core i7-6567U CPU 3.30GHz (Skylake), 1 CPU, 4 logical cores and 2 physical cores
.NET Core SDK=2.1.300-preview2-008530
  [Host]     : .NET Core 2.1.0-preview2-26406-04 (CoreCLR 4.6.26406.07, CoreFX 4.6.26406.04), 64bit RyuJIT
  Job-VDUSZZ : .NET Core 2.1.0-preview2-26406-04 (CoreCLR 4.6.26406.07, CoreFX 4.6.26406.04), 64bit RyuJIT

Runtime=Core  Server=True  Toolchain=.NET Core 2.1  
RunStrategy=Throughput  
View TimeToFirstServiceBenchmark-report-github.md
BenchmarkDotNet=v0.10.13, OS=macOS 10.13.4 (17E199) [Darwin 17.5.0]
Intel Core i7-6567U CPU 3.30GHz (Skylake), 1 CPU, 4 logical cores and 2 physical cores
.NET Core SDK=2.1.300-preview2-008530
  [Host]     : .NET Core 2.1.0-preview2-26406-04 (CoreCLR 4.6.26406.07, CoreFX 4.6.26406.04), 64bit RyuJIT
  Job-LGTEBK : .NET Core 2.1.0-preview2-26406-04 (CoreCLR 4.6.26406.07, CoreFX 4.6.26406.04), 64bit RyuJIT

Runtime=Core  Server=True  Toolchain=.NET Core 2.1  
RunStrategy=Throughput  
View ci.Dockerfile
# escape=`
# Use server core as an installer container to extract PowerShell,
# As this is a multi-stage build, this stage will eventually be thrown away
FROM microsoft/windowsservercore:1709 AS installer-env
# Arguments for installing powershell, must be defined in the container they are used
ARG PS_VERSION=6.0.1
ENV PS_DOWNLOAD_URL https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip
View OrderDetails.cshtml
@{
ViewBag.Title = $"Order {Model.OrderNumber}";
}
<h2>Order #@Model.OrderNumber Details</h2>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Order details</h3>
</div>
View OrderDetails.cs
public bool Matches(RouteData routeData, string httpMethod) =>
HttpMethods.IsGet(httpMethod)
&& string.Equals((string)routeData.Values["controller"],
"orders", StringComparison.OrdinalIgnoreCase)
&& routeData.Values.ContainsKey("id");
View OrderDetails.cs
public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query)
{
var id = (string)routeData.Values["id"];
var response = await new HttpClient().GetAsync(url);
dynamic shipment = await response.Content.AsExpandoAsync();
viewModel.ShippingStatus = shipment.Status;
viewModel.ShippingCourier = shipment.Courier;
View OrderDetails.cs
public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query)
{
var id = (string)routeData.Values["id"];
var response = await new HttpClient().GetAsync(url);
dynamic order = await response.Content.AsExpandoAsync();
viewModel.OrderNumber = order.OrderNumber;
viewModel.OrderItemsCount = order.ItemsCount;