Пример #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Current.DispatcherUnhandledException += OnDispatcherUnhandledException;

            var containerFactory = new SimpleInjectorContainerFactory();
            var container        = containerFactory.CreateSimpleInjectorContainer();
            var resolver         = new SimpleInjectorResolver(container);

            var startUpWindow = (FuzzyExpertActions)resolver.Resolve(typeof(FuzzyExpertActions));

            startUpWindow.Show();
        }
Пример #2
0
        public void Configuration(IAppBuilder app)
        {
            var container = SimpleInjectorContainerFactory.Create();

            container.RegisterPackages();

            container.RegisterSingleton <IOwinContextProvider>(new CallContextOwinContextProvider());

            #region Mapper

            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <RepositoryProfile>();
            });

            container.Register <IMapper>(() => config.CreateMapper(container.GetInstance));

            #endregion Mapper

            app.UseOwinContextExecutionScope(container);

            app.UseOwinContextProvider();

            ConfigureOAuthTokenGeneration(app);

            HttpConfiguration httpConfig = new HttpConfiguration();

            WebApiConfig.Register(httpConfig);

            container.RegisterWebApiControllers(httpConfig);

            httpConfig.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);

            //app.CreatePerOwinContext(() => container.GetInstance<UserManager<ApplicationUser, Guid>>());

            app.UseCors(CorsOptions.AllowAll);

            app.UseWebApi(httpConfig);

            container.Verify();
        }