Esempio n. 1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();

            var mappingContainer = IoCMappingContainer.GetInstance();

            DependencyResolver.SetResolver(new IoCScopeContainer(mappingContainer));

            Mapper.CreateMap <Journal, JournalViewModel>();
            Mapper.CreateMap <JournalViewModel, Journal>();

            Mapper.CreateMap <Journal, JournalUpdateViewModel>();
            Mapper.CreateMap <JournalUpdateViewModel, Journal>();

            Mapper.CreateMap <Journal, SubscriptionViewModel>();
            Mapper.CreateMap <SubscriptionViewModel, Journal>();

            // LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
        }
        public static void Register(HttpConfiguration config)
        {
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            var mappingContainer = IoCMappingContainer.GetInstance();

            config.DependencyResolver = new IoCScopeContainer(mappingContainer);
        }
Esempio n. 3
0
        protected void Application_Start()
        {
            IUnityContainer mappingContainer = IoCMappingContainer.GetInstance();

            DependencyResolver.SetResolver(new IoCScopeContainer(mappingContainer));

            var membershipService = mappingContainer.Resolve <IStaticMembershipService>();

            Database.SetInitializer <JournalsContext>(new ModelChangedInitializer(membershipService));

            ConfigureMVC();

            RegisterAutoMappings();

            log4net.Config.XmlConfigurator.Configure();

            //Operate on context so that the model gets created
            LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
            membershipService.Initialize(); //make sure the websecurity is initialized
        }