Esempio n. 1
0
        // something is wrong with connecting to the site
        // poor man's di
        // this is how a container would be told to run.
        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);

            var controllerFactory = new CommerceControllerFactory();

            ControllerBuilder.Current.SetControllerFactory(controllerFactory);
        }
Esempio n. 2
0
        private static IControllerFactory CreateControllerFactory()
        {
            string connectionString         = ConfigurationManager.AppSettings["SQLDataAccessConnectionString"];
            string productRepositryTypeName = ConfigurationManager.AppSettings["ProductRepositoryType"];

            var productRepositryType = Type.GetType(productRepositryTypeName, true);
            var repository           = (ProductRepository)Activator.CreateInstance(productRepositryType, connectionString);
            var controllerFactory    = new CommerceControllerFactory(repository);

            return(controllerFactory);
        }