public static void Start()
        {
            var kernel = new StandardKernel(new NinjectSettings());

            kernel.Unbind <ModelValidatorProvider>();

            kernel.RegisterDryv();

            kernel.Bind <IOptions <Options2> >().ToMethod(_ => ExamplesConfiguration.CreateOptionsFromCookie <Options2>()).InRequestScope();
            kernel.Bind <IOptions <Options3> >().ToMethod(_ => ExamplesConfiguration.CreateOptionsFromCookie <Options3>()).InRequestScope();

            DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
        }
Exemple #2
0
        public static void Start()
        {
            var container = new UnityContainer();

            FilterProviders.Providers.Remove(FilterProviders.Providers.OfType <FilterAttributeFilterProvider>().First());
            FilterProviders.Providers.Add(new UnityFilterAttributeFilterProvider(container));

            container.RegisterDryv();

            container.RegisterType <IOptions <Options2> >(new InjectionFactory(_ => ExamplesConfiguration.CreateOptionsFromCookie <Options2>()));
            container.RegisterType <IOptions <Options3> >(new InjectionFactory(_ => ExamplesConfiguration.CreateOptionsFromCookie <Options3>()));

            DependencyResolver.SetResolver(new UnityDependencyResolver(container));
        }
        public static void Start()
        {
            var builder = new ContainerBuilder();

            builder.RegisterControllers(typeof(MvcApplication).Assembly);
            builder.RegisterModelBinders(typeof(MvcApplication).Assembly);
            builder.RegisterModelBinderProvider();

            builder.RegisterDryv();

            builder.Register(_ => ExamplesConfiguration.CreateOptionsFromCookie <Options2>());
            builder.Register(_ => ExamplesConfiguration.CreateOptionsFromCookie <Options3>());

            var container = builder.Build();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
        }