예제 #1
0
        public static Container GetContainer()
        {
            var container = new Container();
            var scopedLifestyle = new LifetimeScopeLifestyle();

            container.RegisterPersistenceDependencies(scopedLifestyle);
            container.RegisterModelDependencies(scopedLifestyle);

            return container;
        }
        public static void RegisterDependencies(Container container)
        {
            var webRequestLifeStyle = new WebRequestLifestyle();
            container.RegisterPersistenceDependencies(webRequestLifeStyle);
            container.RegisterModelDependencies(webRequestLifeStyle);

            container.Register<SignInService, SignInService>(webRequestLifeStyle);

            container.Register<UserManager<Administrator>, UserManager<Administrator>>(webRequestLifeStyle);
            container.Register<UserManager<Advertiser>, UserManager<Advertiser>>(webRequestLifeStyle);

            container.Register<IUserStore<Administrator>, AdministratorStore>(webRequestLifeStyle);
            container.Register<IUserStore<Advertiser>, AdvertiserStore>(webRequestLifeStyle);

            container.Register<IAuthenticationManager>(() => HttpContext.Current.GetOwinContext().Authentication, webRequestLifeStyle);

            container.RegisterWebApiControllers(GlobalConfiguration.Configuration);
            GlobalConfiguration.Configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);

            //container.Verify();
        }