Example #1
0
        public ConnegRegistry()
        {
            Handlers.DisableConventionalDiscovery(true);
            HttpRoutes.IncludeType <CustomReaderWriterEndpoint>();
            Services.For <IMessageDeserializer>().Add <XmlReader <SpecialInput> >();
            Services.For <IMessageSerializer>().Add <XmlWriter <SpecialOutput> >();

            Hosting.Configure(app => app.UseJasper());
        }
        public AppWithMiddleware()
        {
            Hosting.Configure(app =>
            {
                app.UseMiddleware <CustomMiddleware>();

                app.UseJasper();

                // Just to show how you can configure ASP.Net Core
                // middleware that runs after Jasper's RequestDelegate,
                // but do note that Jasper has its own default "not found"
                // behavior
                app.Run(c =>
                {
                    c.Response.StatusCode = 404;

                    return(c.Response.WriteAsync("Not found"));
                });
            });
        }
Example #3
0
        public BootstrappingApp()
        {
            Services.For <BootstrappingToken>().Use(new BootstrappingToken(Id));

            Configuration.AddInMemoryCollection(new Dictionary <string, string> {
                { "foo", "bar" }
            });

            Hosting.ConfigureAppConfiguration(c =>
                                              c.AddInMemoryCollection(new Dictionary <string, string> {
                { "team", "chiefs" }
            }));

            Hosting.ConfigureServices(s => s.AddTransient <IService, ServiceFromJasperRegistryConfigure>());

            Hosting.ConfigureServices((c, services) =>
            {
                if (c.HostingEnvironment.EnvironmentName == "Green")
                {
                    services.AddTransient <IService, GreenService>();
                }
            });

            Hosting.Configure(app =>
            {
                app.MapWhen(
                    c => c.Request.Path.Value.Contains("host"),
                    b => b.Run(c => c.Response.WriteAsync("from jasperregistry host")));
            });

            Settings.Alter <BootstrappingSetting>((context, settings) =>
            {
                settings.Environment = context.HostingEnvironment.EnvironmentName;
                settings.Team        = context.Configuration["team"];
                settings.City        = context.Configuration["city"];
            });
        }