Exemple #1
0
        public static void RegisterIoC(HttpConfiguration config)
        {
            var module = new ApplicationBindings((a) => {
                a.Rebind <IDataBaseContext>().To <FakeDataBaseContext>();
            });
            //module.Rebind<IDataBaseContext>().To<FakeDataBaseContext>();

            var kernel = new StandardKernel(module);

            config.DependencyResolver = new NinjectDependencyResolver(kernel);

            var jsonFormater = GlobalConfiguration.Configuration.Formatters.JsonFormatter;

            jsonFormater.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

            config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        }
        public ControllerFactory()
        {
            var module = new ApplicationBindings();

            IoC = new StandardKernel(module);
        }