protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); bootstrapper = new Bootstrapper(); bootstrapper.Run(); }
public void InitContainer() { this.Container = UnityBootstrapper.Bootstrap(); // todo: move to config? this.Container.RegisterType <IMappingSourceManager, MappingSourceManager>(); }
public UnityServiceHostFactory() { _container = new UnityContainer(); var bootstrapper = new UnityBootstrapper(); bootstrapper.RegisterTypes(_container); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); UnityBootstrapper.Initialise(); }
void Application_Start(object sender, EventArgs e) { // Code that runs on application startup UnityBootstrapper.Initialize(); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes); }
public static void StartDefault() { var configSource = new SystemConfigurationSource(); var bootstrapperConfig = new UnityBootstrapperConfiguration(configSource); var bootstrapper = new UnityBootstrapper(bootstrapperConfig); bootstrapper.Startup(); }
protected void Application_Start(object sender, EventArgs e) { var configSource = new WebConfigurationSource(); var bootstrapperConfig = new UnityBootstrapperConfiguration(configSource); var bootstrapper = new UnityBootstrapper(bootstrapperConfig); bootstrapper.Startup(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); UnityBootstrapper.Initialise(); }
public void Should_be_able_to_create_adapter() { var buildManager = new Mock<IBuildManager>(); buildManager.SetupGet(bm => bm.Assemblies).Returns(new[] { GetType().Assembly }); var bootstrapper = new UnityBootstrapper(buildManager.Object, new Mock<IBootstrapperTasksRegistry>().Object, new Mock<IPerRequestTasksRegistry>().Object); Assert.IsType<UnityAdapter>(bootstrapper.Adapter); }
public static void RegisterInfrastructure(this UnityBootstrapper bootstrapper, string applicationName) { var applicationController = new PrismApplicationController( bootstrapper.Container.Resolve <IRegionManager>(), applicationName, new PrismDependencyContainer(bootstrapper.Container)); applicationController.RegisterInfrastructure(new ApplicationOptionsViewModel(applicationController), new PrismSettingsManager(applicationController)); applicationController.RegisterType <IDialogController, DialogController>(); applicationController.RegisterTypeForNavigation <SavedRequestDialog>(); }
public void Should_be_able_to_create_adapter() { var buildManager = new Mock <IBuildManager>(); buildManager.SetupGet(bm => bm.Assemblies).Returns(new[] { GetType().Assembly }); var bootstrapper = new UnityBootstrapper(buildManager.Object, new Mock <IBootstrapperTasksRegistry>().Object, new Mock <IPerRequestTasksRegistry>().Object); Assert.IsType <UnityAdapter>(bootstrapper.Adapter); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); UnityBootstrapper.RegisterComponents(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ServicePointManager.ServerCertificateValidationCallback = (obj, certificate, chain, errors) => true; }
public void BootstrapperShutdownTest() { var configSource = new DefaultUnityStaticConfigurationSource(); var bootstrapperConfig = new UnityBootstrapperConfiguration(configSource); var bootstrapper = new UnityBootstrapper(bootstrapperConfig); bootstrapper.Startup(); bootstrapper.Shutdown(); }
private static void Main(string[] args) { try { var container = UnityBootstrapper.Initialize(); var cardServiceProvider = container.Resolve <ICardServiceProvider>(); var cardFactory = container.Resolve <ICardFactory <VirtualCashCard> >(); var card = cardFactory.CreateCard(1234, 500); while (true) { Console.WriteLine("Please select from the following options:"); Console.Write("Enter 1 to withdraw amount or 2 to Top-up or Q|q to quit: "); var response = Console.ReadLine(); try { switch (response) { case "Q": case "q": Environment.Exit(0); break; case "1": var withdrawAmount = cardServiceProvider.Withdraw(card, RequestPin(), RequestAmount()); Console.WriteLine($"{withdrawAmount:C} withdrawn successfully\n\n"); break; case "2": var pin = RequestPin(); var topUpAmount = RequestAmount(); cardServiceProvider.TopUp(card, pin, topUpAmount); Console.WriteLine($"{topUpAmount:C} topped up successfully\n\n"); break; default: WriteError("Invalid option entered. Try again!\n\n"); break; } } catch (InvalidOperationException exception) { WriteError($"{exception.Message}\n\n"); } } } catch (Exception exception) { WriteError($"{exception.Message}\n\n"); } Console.ReadLine(); }
public void Should_be_able_to_load_modules() { var buildManager = new Mock<IBuildManager>(); buildManager.SetupGet(bm => bm.ConcreteTypes).Returns(new[] { typeof(DummyModule) }); var bootstrapper = new UnityBootstrapper(buildManager.Object, new Mock<IBootstrapperTasksRegistry>().Object, new Mock<IPerRequestTasksRegistry>().Object); DummyModule.Loaded = false; Assert.IsType<UnityAdapter>(bootstrapper.Adapter); Assert.True(DummyModule.Loaded); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); IIocBootstrapper bootstrapper = new UnityBootstrapper(); IInjectionContainer container = bootstrapper.GetContainer(); DependencyResolver.SetResolver(new IocDependencyResolver(container)); }
/// <summary> /// Loads The Inital View Models Including Application Options To The UI /// </summary> /// <param name="bootstrapper"></param> public static void InitialiseLoadShell(this UnityBootstrapper bootstrapper) { var applicationOptionsViewModel = bootstrapper.Container.Resolve <IApplicationOptions>(); bootstrapper.Container.Resolve <IRegionManager>() .RegisterViewWithRegion(RegionNames.ApplicationOptions, () => applicationOptionsViewModel); var applicationViewModel = (ApplicationOptionsViewModel)bootstrapper.Container.Resolve <IApplicationOptions>(); bootstrapper.Container.Resolve <IRegionManager>() .RegisterViewWithRegion(RegionNames.Heading, () => applicationViewModel.ApplicationController); }
public void Should_be_able_to_load_modules() { var buildManager = new Mock <IBuildManager>(); buildManager.SetupGet(bm => bm.ConcreteTypes).Returns(new[] { typeof(DummyModule) }); var bootstrapper = new UnityBootstrapper(buildManager.Object, new Mock <IBootstrapperTasksRegistry>().Object, new Mock <IPerRequestTasksRegistry>().Object); DummyModule.Loaded = false; Assert.IsType <UnityAdapter>(bootstrapper.Adapter); Assert.True(DummyModule.Loaded); }
public static void Main(string[] args) { var configSource = new SystemConfigurationSource(); var bootstrapperConfig = new UnityBootstrapperConfiguration(configSource); var bootstrapper = new UnityBootstrapper(bootstrapperConfig); bootstrapper.Startup(); EventfulRestClient(); Console.ReadLine(); Console.WriteLine("Press a key to exit.."); Console.ReadLine(); }
protected void Application_Start() { UnityBootstrapper.Initialize(HttpContext.Current); RegisterControllerFactory(); RegisterRoutes(); RegisterUrlResolver(); // databinding bug workaround (http://forums.asp.net/t/1632006.aspx) ModelMetadataProviders.Current = new DataAnnotationsModelMetadataProvider(); _taskRunner = new TaskRunner(UnityBootstrapper.Container); _taskRunner.Start(); }
public void BootstrapperStartupTest() { var configSource = new SystemConfigurationSource(); var bootstrapperConfig = new UnityBootstrapperConfiguration(configSource); var bootstrapper = new UnityBootstrapper(bootstrapperConfig); bootstrapper.AddBootstrapperTasks(new BootstrapperTask()); bootstrapper.Startup(); var expected = typeof(TraceLoggerFactory); var actual = ServiceLocator.Current.GetInstance <ILoggerFactory>().GetType(); Assert.AreEqual(expected, actual); }
protected override async void OnStartup(StartupEventArgs e) { base.OnStartup(e); await DbInitialise.Initialise(); _container.RegisterType <IServiceRepository, ServiceRepository>(new ContainerControlledLifetimeManager()); _container.RegisterType <IWatchedServiceRepository, WatchedServiceRepository>(new ContainerControlledLifetimeManager()); _container.RegisterType <IDescriptionService, DescriptionService>(new TransientLifetimeManager()); _container.RegisterType <IStatusService, StatusService>(new TransientLifetimeManager()); UnityBootstrapper.Register(_container); var window = _container.Resolve <MainWindow>(); _trayIcon = Icon.Create(window); }
static void Main() { var owned = false; var instanceMutex = new Mutex(false, "My2Cents.HTC.AHPilotStats.App", out owned); if (owned) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); UnityBootstrapper.Initialise(); Application.Run(ServiceLocator.Instance.Resolve <MainMDI>()); } else { MessageBox.Show("Sorry, but you can only start one version at a time.", "Aces High Pilot Stats - Error"); } }
private static void AssertExceptionThrownOnRun(UnityBootstrapper bootstrapper, Type expectedExceptionType, string expectedExceptionMessageSubstring) { bool exceptionThrown = false; try { bootstrapper.Run(); } catch (Exception ex) { Assert.AreEqual(expectedExceptionType, ex.GetType()); StringAssert.Contains(ex.Message, expectedExceptionMessageSubstring); exceptionThrown = true; } if (!exceptionThrown) { Assert.Fail("Exception not thrown."); } }
private static void Main(string[] args) { var configSource = new SystemConfigurationSource(); var bootstrapperConfig = new UnityBootstrapperConfiguration(configSource); var bootstrapper = new UnityBootstrapper(bootstrapperConfig); bootstrapper.Startup(); WriteContainerInfo(); //LoggerSample(); //SettingSample(); CachedSettingBehaviorSample(); //FindTypes(); WriteContainerInfo(); Console.ReadLine(); }
/// <summary> /// Initialize the App launch. /// </summary> /// <returns>The AppShell of the app.</returns> private AppShell Initialize() { var shell = Window.Current.Content as AppShell; if (shell == null) { UnityBootstrapper.Init(); UnityBootstrapper.ConfigureRegistries(); // Create a AppShell to act as the navigation context and navigate to the first page shell = new AppShell(); // Set the default language shell.Language = ApplicationLanguages.Languages[0]; shell.AppFrame.NavigationFailed += OnNavigationFailed; } return(shell); }
/// <summary> /// Initialize the App launch. /// </summary> /// <returns>The AppShell of the app.</returns> private async Task <AppShell> Initialize() { var shell = Window.Current.Content as AppShell; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (shell == null) { UnityBootstrapper.Init(); UnityBootstrapper.ConfigureRegistries(); await AppInitialization.DoInitialization(); // Create a AppShell to act as the navigation context and navigate to the first page shell = new AppShell() { // Set the default language Language = ApplicationLanguages.Languages[0] }; shell.AppFrame.NavigationFailed += OnNavigationFailed; } return(shell); }
static void Main() { using (var container = new UnityContainer()) { UnityBootstrapper.Register(container); var service = container.Resolve <IPictureService>(); Action start = new Action(service.Start); Action stop = new Action(service.Stop); _exit = new ManualResetEvent(false); Console.CancelKeyPress += (sender, eventArgs) => { Console.WriteLine("Cancelling service..."); stop?.Invoke(); _exit.Set(); _exit.Close(); }; start.Invoke(); Console.WriteLine("Press CTRL+C to stop"); _exit.WaitOne(); _exit.Close(); } }
public App() { _medicalInformationAgentBootstrapper = new MedicalServiceBootstrapper(); }
public static void RegisterComponents(HttpConfiguration config, MapperConfiguration mapperConfiguration) { var container = UnityBootstrapper.Initialise(mapperConfiguration); config.DependencyResolver = new UnityDependencyResolver(container); }
private AppRunner(UnityBootstrapper unityBootstrapper) { _unityBootstrapper = unityBootstrapper; }
public static void Run(string[] args, UnityBootstrapper bootstrapper) { Current = new AppRunner(bootstrapper); Current.Run(ParseCommandLineArgs(args)); }