Instantly share code, notes, and snippets.

View module.cs
using System.Threading;
using System.Threading.Tasks;
using Nancy;
public class DemoModule: NancyV1Module
{
public DemoModule()
{
Get["named", "/sync"] = DoSync;
Get["/sync/noname"] = DoSync;
View NancyV1Module.cs
using System;
using System.Threading;
using System.Threading.Tasks;
using Nancy;
public class NancyV1Module : NancyModule
{
public NancyV1RouteBuilder Get => new NancyV1RouteBuilder(this, NancyV1RouteBuilder.HttpMethod.Get);
public NancyV1RouteBuilder Put => new NancyV1RouteBuilder(this, NancyV1RouteBuilder.HttpMethod.Put);
public NancyV1RouteBuilder Post => new NancyV1RouteBuilder(this, NancyV1RouteBuilder.HttpMethod.Post);
View nancy.cs
public class ProductsModule : NancyModule
{
public ProductsModule()
{
Get["/products/{id}", runAsync: true] = async (_, token) =>
{
//do something long and tedious
};
}
}
View dependsOn.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using Newtonsoft.Json;
using static Bullseye.Targets;
namespace bulltest
{
class Program
View defaultTask.cs
using System;
using static Bullseye.Targets;
namespace bulltest
{
class Program
{
static void Main(string[] args)
{
Target("default", () => {
View csproj.xml
<PropertyGroup>
<Product>Microsoft ASP.NET Core MVC</Product>
<RepositoryUrl>https://github.com/aspnet/Mvc</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)build\Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<AssemblySigningCertName>Microsoft</AssemblySigningCertName>
<PackageSigningCertName>MicrosoftNuGet</PackageSigningCertName>
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
View program.cs
using System;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
namespace Demo
{
public class Program
{
public static void Main(string[] args)
{
View startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace Demo
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
View extension.cs
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
View renderer.cs
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using ClassLibrary;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Internal;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;