當前位置: 首頁>>代碼示例>>C#>>正文


C# Bootstrapper類代碼示例

本文整理匯總了C#中Bootstrapper的典型用法代碼示例。如果您正苦於以下問題:C# Bootstrapper類的具體用法?C# Bootstrapper怎麽用?C# Bootstrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Bootstrapper類屬於命名空間,在下文中一共展示了Bootstrapper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Bootstrapper bootstrapper = new Bootstrapper();
            bootstrapper.Run();
        }
開發者ID:jdhemry,項目名稱:UnifiedData,代碼行數:7,代碼來源:App.xaml.cs

示例2: App

        static App()
        {
            DispatcherHelper.Initialize();

            //AppDomain domain = AppDomain.CurrentDomain;
            //domain.SetupInformation.PrivateBinPath = @"\\Plugins";

            //AppDomainSetup domain = new AppDomainSetup();
            //domain.PrivateBinPath = @"Plugins";

            //FIXME: AppendPrivatePath is deprecated.
            string pluginsFolder = @".\Plugins\";
            string pluginsFolderFullPath = Path.GetFullPath(pluginsFolder);
            if (!Directory.Exists(pluginsFolderFullPath))
                Directory.CreateDirectory(pluginsFolderFullPath);

            AppDomain.CurrentDomain.AppendPrivatePath(pluginsFolderFullPath);

            string[] pluginSubdirectories = Directory.GetDirectories(pluginsFolderFullPath);
            foreach (string pluginSubdirectory in pluginSubdirectories)
            {
                AppDomain.CurrentDomain.AppendPrivatePath(pluginSubdirectory);
            }

            Bootstrapper bootstrapper = new Bootstrapper();
        }
開發者ID:uygary,項目名稱:Watchtower,代碼行數:26,代碼來源:App.xaml.cs

示例3: ApplicationStartup

        protected override void ApplicationStartup(IUnityContainer container, Bootstrapper.IPipelines pipelines)
        {
            RequestContainerConfigured = true;

            container.RegisterType<IFoo, Foo>(new ContainerControlledLifetimeManager());
            container.RegisterType<IDependency, Dependency>(new ContainerControlledLifetimeManager());
        }
開發者ID:denkhaus,項目名稱:Nancy.Bootstrappers.Unity,代碼行數:7,代碼來源:FakeUnityNancyBootstrapper.cs

示例4: TestBase

 public TestBase()
 {
     var bootstrapper = new Bootstrapper();
     host = new NancyHost(bootstrapper, new Uri(path));
     host.Start();
     Console.WriteLine("*** Host listening on " + path);
 }
開發者ID:24hr,項目名稱:SimpleHttpClient,代碼行數:7,代碼來源:TestBase.cs

示例5: Configuration

        public void Configuration(IAppBuilder app)
        {
            //log4net.Config.XmlConfigurator.Configure();

            var bootstrapper = new Bootstrapper();
            var container = bootstrapper.Build();
            var priceFeed = container.Resolve<IPriceFeed>();
            priceFeed.Start();
            var cleaner = container.Resolve<Cleaner>();
            cleaner.Start();

            app.UseCors(CorsOptions.AllowAll);
            app.Map("/signalr", map =>
            {
                var hubConfiguration = new HubConfiguration
                {
                    // you don't want to use that in prod, just when debugging
                    EnableDetailedErrors = true,
                    EnableJSONP = true,
                    Resolver = new AutofacSignalRDependencyResolver(container)
                };

                map.UseCors(CorsOptions.AllowAll)
                    .RunSignalR(hubConfiguration);
            });
        }
開發者ID:dancingchrissit,項目名稱:ReactiveTrader,代碼行數:26,代碼來源:Startup.cs

示例6: GetImporterPlugins

        public static IEnumerable<ICmsImporterPlugin> GetImporterPlugins()
        {
            IEnumerable<ICmsImporterPlugin> plugins = new BindingList<ICmsImporterPlugin>();
            try
            {
                var bootStrapper = new Bootstrapper();

                //An aggregate catalog that combines multiple catalogs
                var catalog = new AggregateCatalog();
                //Adds all the parts found in same directory where the application is running!
                var currentPath = HostingEnvironment.ApplicationPhysicalPath;
                currentPath = String.Format("{0}Bin\\PlugIns", currentPath);

                catalog.Catalogs.Add(new DirectoryCatalog(currentPath));

                //Create the CompositionContainer with the parts in the catalog
                var container = new CompositionContainer(catalog);

                //Fill the imports of this object
                container.ComposeParts(bootStrapper);

                plugins = bootStrapper.ImporterPlugins;
            }
            catch (CompositionException compositionException)
            {
                log.Error("", compositionException, compositionException.Message);
            }
            catch (Exception ex)
            {
                log.Error("", ex, ex.Message);
            }

            return plugins;
        }
開發者ID:barrett2474,項目名稱:CMS2,代碼行數:34,代碼來源:Util.cs

示例7: Main

 private static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     var bootstrapper = new Bootstrapper<MainViewModel>(new AutofacContainer());
     bootstrapper.Start();
 }
開發者ID:dbeattie71,項目名稱:MugenMvvmToolkit.Samples,代碼行數:7,代碼來源:Program.cs

示例8: OnStartup

		protected override void OnStartup(StartupEventArgs e)
		{
			base.OnStartup(e);
			try
			{
				string fileName;
				AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
				ApplicationService.Closing += new System.ComponentModel.CancelEventHandler(ApplicationService_Closing);
				ThemeHelper.LoadThemeFromRegister();
#if DEBUG
				bool trace = false;
				BindingErrorListener.Listen(m => { if (trace) MessageBox.Show(m); });
#endif
				_bootstrapper = new Bootstrapper();
				using (new DoubleLaunchLocker(SignalId, WaitId))
					_bootstrapper.Initialize();
				if (Application.Current != null && e.Args != null && e.Args.Length > 0)
				{
					fileName = e.Args[0];
					FileConfigurationHelper.LoadFromFile(fileName);
				}
			}
			finally
			{
				ServiceFactory.StartupService.Close();
			}
		}
開發者ID:xbadcode,項目名稱:Rubezh,代碼行數:27,代碼來源:App.cs

示例9: Main

        static void Main()
        {
            var container = new Bootstrapper()
                .RegisterComponents()
                .Container;

            using (var uow = container.Resolve<IUnitOfWork>())
            {
                var query = new GetAddressByCity("Bothell");
                var address = uow.ExecuteQuery(query);
                Console.WriteLine("AdventureWorks DB: PLZ von Bothell: {0}", address.PostalCode);
            }

            using (var uow = container.Resolve<IUnitOfWork>())
            {
                var employee = uow.Entities<Employee>().First();
                Console.WriteLine("Northwind DB: Name des ersten Eintrags {0} {1}", employee.FirstName, employee.LastName);
            }

            using (var uow = container.Resolve<IUnitOfWork>())
            {
                var sqlFunction = new GetProductListPrice(707, new DateTime(2008, 1, 1));
                var productListPrice = uow.ExecuteFunction(sqlFunction);

                Console.WriteLine("Aufruf der SQL Funktion GetProductListPrice ergibt den Wert: {0}", productListPrice);
            }

            Console.ReadLine();
        }
開發者ID:srasch,項目名稱:MyCleanEntityFramework,代碼行數:29,代碼來源:Program.cs

示例10: OnStartup

        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs" /> that contains the event data.</param>
        protected override void OnStartup(System.Windows.StartupEventArgs e)
        {
            var bootstrapper = new Bootstrapper();
            bootstrapper.RunWithSplashScreen<ProgressNotifyableViewModel>();

            base.OnStartup(e);
        }
開發者ID:Catel,項目名稱:Catel.LogAnalyzer,代碼行數:11,代碼來源:App.xaml.cs

示例11: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var bstrap = new Bootstrapper();
            bstrap.Run();
        }
開發者ID:Khayde,項目名稱:slimCat,代碼行數:7,代碼來源:App.xaml.cs

示例12: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var bootstrapper = new Bootstrapper();
            var shellView = bootstrapper.Bootstrap();

            var bus = bootstrapper.Resolve<IMessageBus>();

            bus.RegisterMessageSource(this.GetActivated().Select(_ => new ApplicationActivatedMessage()));
            bus.RegisterMessageSource(this.GetDeactivated().Select(_ => new ApplicationDeactivatedMessage()));

            shellView.Window.Show();

            MainWindow = shellView.Window;
            ShutdownMode = ShutdownMode.OnMainWindowClose;

            var toastWindow = bootstrapper.Resolve<IToastWindow>();
            toastWindow.Window.Show();

            //int i = 1;
            //bus.RegisterMessageSource(Observable.Interval(TimeSpan.FromSeconds(3)).Select(_ => i++)
            //    .Take(100).Select(num => new ShowToastMessage(
            //    new NotificationMessage(
            //        new Room { Name = "Ohai " + num },
            //        new User { Name = "Arild" },
            //        new Message { Body = "Ohai thar " + num, MessageTypeString = MessageType.TextMessage.ToString() }),
            //        new ShowToastNotificationAction())));
        }
開發者ID:Doomblaster,項目名稱:MetroFire,代碼行數:29,代碼來源:App.xaml.cs

示例13: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            if (e.Args.Any(item => string.Equals(item, "Integrate", StringComparison.InvariantCultureIgnoreCase)))
            {
                RegistryHelper.Integrate();
                Environment.Exit(1);
            }
            if (e.Args.Any(item => string.Equals(item, "Desintegrate", StringComparison.InvariantCultureIgnoreCase)))
            {
                RegistryHelper.Desintegrate();
                Environment.Exit(1);
            }

            #if DEBUG
            BindingErrorListener.Listen(m => MessageBox.Show(m));
            #endif
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            ApplicationService.Closing += new System.ComponentModel.CancelEventHandler(ApplicationService_Closing);

            _bootstrapper = new Bootstrapper();
            using (new DoubleLaunchLocker(SignalId, WaitId))
                _bootstrapper.Initialize();
        }
開發者ID:hjlfmy,項目名稱:Rubezh,代碼行數:25,代碼來源:App.xaml.cs

示例14: Startup

 public Startup(IObjectContainer objectContainer)
 {
     var containerAdapter = new ObjectContainerAdapter(objectContainer);
     var bootstrapper =
         new Bootstrapper(containerAdapter)
         .Use(new RegisterCompositionModulesMiddleware<Bootstrapper>());            
     bootstrapper.Initialize();            
 }                       
開發者ID:LogoFX,項目名稱:Samples.Specifications,代碼行數:8,代碼來源:Startup.cs

示例15: ExpectAsyncNamedRouteIsResolvedCorrectlyByService

		public void ExpectAsyncNamedRouteIsResolvedCorrectlyByService(RouteRegistrar registrar, Guid token)
		{
			using (var bootstrapper = new Bootstrapper())
			{
				var browser = new Browser(bootstrapper);
				browser.Get<NamedRouteResponse>("/named/async/" + token).Uri.Should().Be("/some-named-async-route/" + token);
			}
		}
開發者ID:serenata-evaldas,項目名稱:Nancy.ServiceRouting,代碼行數:8,代碼來源:NamedRouteTest.cs


注:本文中的Bootstrapper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。