This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<TargetFramework>netstandard2.0</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.1" /> | |
</ItemGroup> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var session = store.LightweightSession()) | |
{ | |
if(!session.Query<IdentityServer4.Postgresql.Entities.ApiResource>().Any()) | |
{ | |
var resources = new List<IdentityServer4.Postgresql.Entities.ApiResource> { | |
new IdentityServer4.Postgresql.Entities.ApiResource{ Name = "api1" , Description = "Api" , DisplayName ="api1" }, | |
}; | |
session.StoreObjects(resources); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 1.0.{build} | |
os: Visual Studio 2015 | |
environment: | |
marten-testing-database: "Host=localhost;Port=5432;Database=marten_test;Username=postgres;Password=Password12!" | |
POSTGRES_PATH: C:\Program Files\PostgreSQL\9.5 | |
PG_PLV8_EXTENSION_ZIP_FILENAME: pg95plv8jsbin_w64 | |
PG_DB: marten_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task<IContainer> CreateEndpoints(IServiceCollection services) | |
{ | |
var builder = new ContainerBuilder(); | |
builder.Populate(services); | |
var container = builder.Build(); | |
var settings = container.Resolve<IOptions<ServiceBusHostOptions>>().Value; | |
var _store = new DocumentStore { Url = settings.Url, DefaultDatabase = settings.DatabaseName }; | |
_store.Initialize(); | |
foreach (var endpoint in settings.Endpoints) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler(); | |
IJobDetail job = JobBuilder.Create<QuickJob>().Build(); | |
ITrigger trigger = TriggerBuilder.Create().StartNow().WithSimpleSchedule(x => x | |
.WithIntervalInSeconds(10) | |
.RepeatForever()).Build(); | |
protected override void ApplicationStartup(IContainer container, IPipelines pipelines) | |
{ | |
base.ApplicationStartup(container, pipelines); | |
scheduler.ScheduleJob(job, trigger); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void Configure(INancyEnvironment environment) | |
{ | |
environment.Views(runtimeViewUpdates: true); | |
base.Configure(environment); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AtomResponse : Response | |
{ | |
public AtomResponse(SyndicationFeed feed) | |
{ | |
StatusCode = HttpStatusCode.OK; | |
ContentType = "application/atom+xml"; | |
Contents = stream => | |
{ | |
var settings = new XmlWriterSettings | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void GetHandler(this NancyModule module, string path, Func<object> handler) | |
{ | |
module.Get[path] = _ => RunHandler(module, handler); | |
} | |
public static void GetHandler<TIn>(this NancyModule module, string path, Func<TIn, object> handler) | |
{ | |
module.Get[path] = _ => RunHandler(module, handler); | |
} | |