コード例 #1
0
        public void Configuration(IAppBuilder appBuilder)
        {
            var bootstrapper = new WindsorBootstrapper(AppDomain.CurrentDomain.BaseDirectory, filter: "Divergent.Sales*.*");
            var container    = bootstrapper.Boot();

            var config = new HttpConfiguration();

            config.Formatters.Clear();
            config.Formatters.Add(new JsonMediaTypeFormatter());

            config.DependencyResolver = new WindsorDependencyResolver(container);

            config.Formatters
            .JsonFormatter
            .SerializerSettings
            .ContractResolver = new CamelCasePropertyNamesContractResolver();

            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            appBuilder.UseCors(CorsOptions.AllowAll);
            appBuilder.UseWebApi(config);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var bootstrapper = new WindsorBootstrapper
                               (
                directory: AppDomain.CurrentDomain.BaseDirectory, //the directory where to look for assemblies
                filter: "*.*"                                     //the default filer is *.dll, but this is and exe so we need to include it to
                               );

            //the bootstrap process will look for any class
            //the implements the IWindsorInstaller inetrface
            //and is exported via MEF
            var container = bootstrapper.Boot();

            var config = new BusConfiguration();

            config.UsePersistence <InMemoryPersistence>();
            config.UseSerialization <JsonSerializer>();
            config.UseTransport <RabbitMQTransport>()
            .ConnectionString("host=localhost");

            config.UseContainer <NServiceBus.WindsorBuilder>(c =>
            {
                c.ExistingContainer(container);
            });
        }
コード例 #3
0
        protected void Application_Start()
        {
            var basePath = AppDomain.CurrentDomain.BaseDirectory;

            var bootstrapper = new WindsorBootstrapper(Path.Combine(basePath, "bin"));
            var container    = bootstrapper.Boot();

            GlobalConfiguration.Configure(http => WebApiConfig.Register(http, container));
        }
コード例 #4
0
ファイル: Startup.cs プロジェクト: micdenny/HotelReservation
        public void Configuration(IAppBuilder appBuilder)
        {
            Console.Title = typeof(Startup).Namespace;

            var bootstrapper = new WindsorBootstrapper(AppDomain.CurrentDomain.BaseDirectory, filter: "Reservations*.*");
            var container    = bootstrapper.Boot();

            ConfigureNServiceBus(container);
            ConfigureWebAPI(appBuilder, container);
        }
コード例 #5
0
ファイル: Global.asax.cs プロジェクト: UGIdotNET/Eventi2016
        protected void Application_Start()
        {
            var basePath = AppDomain.CurrentDomain.BaseDirectory;

            var bootstrapper = new WindsorBootstrapper(Path.Combine(basePath, "bin"));
            var container    = bootstrapper.Boot();

            container.Register(Component.For <ISalesContext>()
                               .Instance(new SalesContext())
                               .LifestylePerWebRequest());

            GlobalConfiguration.Configure(http => WebApiConfig.Register(http, container));
        }
コード例 #6
0
ファイル: Startup.cs プロジェクト: poliset/shopper
        public void Configuration(IAppBuilder appBuilder)
        {
            var bootstrapper = new WindsorBootstrapper(AppDomain.CurrentDomain.BaseDirectory, filter: "Marketing*.*");
            var container    = bootstrapper.Boot();

            var store = CommonConfiguration.CreateEmbeddableDocumentStore("Marketing", session =>
            {
                SeedData.Products().ForEach(s => session.Store(s));
                session.Store(SeedData.HomeStructure());
            });

            container.Register(Component.For <IDocumentStore>().Instance(store).LifestyleSingleton());

            var endpointConfiguration = new EndpointConfiguration("Marketing");

            endpointConfiguration.UseContainer <WindsorBuilder>(c => c.ExistingContainer(container));

            endpointConfiguration.ApplyCommonConfiguration();
            endpointConfiguration.UseRavenPersistence(store);
            endpointConfiguration.LimitMessageProcessingConcurrencyTo(1);

            //var timeoutManager = endpointConfiguration.TimeoutManager();
            //timeoutManager.LimitMessageProcessingConcurrencyTo(4);

            var endpoint = Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();

            container.Register(Component.For <IMessageSession>().Instance(endpoint));

            var config = new HttpConfiguration();

            config.Formatters.Clear();
            config.Formatters.Add(new JsonMediaTypeFormatter());

            config.DependencyResolver = new WindsorDependencyResolver(container);

            config.Formatters
            .JsonFormatter
            .SerializerSettings
            .ContractResolver = new CamelCasePropertyNamesContractResolver();

            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            appBuilder.UseCors(CorsOptions.AllowAll);
            appBuilder.UseWebApi(config);
        }
コード例 #7
0
        protected void Application_Start()
        {
            var basePath = AppDomain.CurrentDomain.BaseDirectory;

            var bootstrapper = new WindsorBootstrapper(Path.Combine(basePath, "bin"));
            var container    = bootstrapper.Boot();

            var dataManagerComponent = Component.For <IOrderRepository>()
                                       .Instance(new OrderRepository())
                                       .LifestyleSingleton();

            container.Register(dataManagerComponent);

            GlobalConfiguration.Configure(http => WebApiConfig.Register(http, container));
        }
コード例 #8
0
        protected override void OnStart(string[] args)
        {
            var baseAddress = ConfigurationManager.AppSettings["owin/baseAddress"];

            var bootstrapper = new WindsorBootstrapper(AppDomain.CurrentDomain.BaseDirectory);
            var windsor      = bootstrapper.Boot();

            this._server = new ServerHost(
                baseAddress,
                bootstrapper.ProbeDirectory,
                windsor);

            AddODataSupport(this._server);
            AddSignalRSupport(this._server);

            this._server.Start();
        }
コード例 #9
0
		protected override void OnStart( string[] args )
		{
			var baseAddress = ConfigurationManager.AppSettings[ "owin/baseAddress" ];

			var bootstrapper = new WindsorBootstrapper( AppDomain.CurrentDomain.BaseDirectory );
			var windsor = bootstrapper.Boot();

			this._server = new ServerHost(
				baseAddress,
				bootstrapper.ProbeDirectory,
				windsor );

			AddODataSupport( this._server );
			AddSignalRSupport( this._server );

			this._server.Start();
		}
コード例 #10
0
        // This code configures Web API. The Startup class is specified as a type
        // parameter in the WebApp.Start method.
        public void Configuration(IAppBuilder appBuilder)
        {
            var bootstrapper = new WindsorBootstrapper(AppDomain.CurrentDomain.BaseDirectory, filter: "CustomerCare*.*");
            var container    = bootstrapper.Boot();

            var store = CommonConfiguration.CreateEmbeddableDocumentStore("CustomerCare", session =>
            {
                SeedData.Raitings().ForEach(r => session.Store(r));
                SeedData.Reviews().ForEach(r => session.Store(r));
            });

            container.Register(Component.For <IDocumentStore>().Instance(store).LifestyleSingleton());

            var config = new HttpConfiguration();

            config.Formatters.Clear();
            config.Formatters.Add(new JsonMediaTypeFormatter());

            config.DependencyResolver = new WindsorDependencyResolver(container);

            config.Formatters
            .JsonFormatter
            .SerializerSettings
            .ContractResolver = new CamelCasePropertyNamesContractResolver();

            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            HttpServer server = new HttpServer(config);

            config.Routes.MapHttpBatchRoute(
                routeName: "batch",
                routeTemplate: "api/batch",
                batchHandler: new DefaultHttpBatchHandler(server)
                );

            appBuilder.UseCors(CorsOptions.AllowAll);
            appBuilder.UseWebApi(config);
        }
コード例 #11
0
		static void Main( string[] args )
		{
			var bootstrapper = new WindsorBootstrapper
			(
				directory: AppDomain.CurrentDomain.BaseDirectory, //the directory where to look for assemblies
				filter: "*.*" //the default filer is *.dll, but this is and exe so we need to include it to
			);

			//the bootstrap process will look for any class 
			//the implements the IWindsorInstaller inetrface
			//and is exported via MEF
			var container = bootstrapper.Boot();

			var config = new BusConfiguration();
			config.UsePersistence<InMemoryPersistence>();
			config.UseContainer<NServiceBus.WindsorBuilder>( c =>
			{
				c.ExistingContainer( container );
			} );
		}
コード例 #12
0
ファイル: Program.cs プロジェクト: youlin1210/MySample
        public static async Task Main(string[] args)
        {
            Console.Title = MethodBase.GetCurrentMethod().DeclaringType.Namespace;

            var tcs = new TaskCompletionSource <object>();

            Console.CancelKeyPress += (sender, e) => { tcs.SetResult(null); };

            var basePath = AppDomain.CurrentDomain.BaseDirectory;

            var bootstrapper = new WindsorBootstrapper(basePath, filter: "Divergent*.*");
            var container    = bootstrapper.Boot();

            NServiceBusConfig.Configure(container);

            using (WebApp.Start(new StartOptions("http://localhost:20185"), builder => WebApiConfig.Configure(builder, container)))
            {
                await Console.Out.WriteLineAsync("Web server is running.");

                await Console.Out.WriteLineAsync("Press Ctrl+C to exit...");

                await tcs.Task;
            }
        }