Esempio n. 1
0
        public KernelBuilder ForWebApplication()
        {
            if (_mode.HasValue)
            {
                throw new InvalidOperationException("Mode already set");
            }
            _mode = KernelMode.Web;

            _builderActions.Add(kernel => kernel.Bind <Func <IKernel> >().ToMethod(ctx => () => new Bootstrapper().Kernel));
            _builderActions.Add(kernel => kernel.Bind <IHttpModule>().To <HttpApplicationInitializationHttpModule>());

            //Register automapper
            _builderActions.Add(kernel => kernel.Bind <IMapper>().ToConstant(MappingConfig.CreateMapper()).InSingletonScope());

            return(this);
        }