コード例 #1
0
        protected void Application_Start()
        {
            ObjectContainer.AddPrototypeDefinition(typeof(ISysCEFWorkLifetimeManager), typeof(SysCEFPerRequestWorkLifetimeManager));

            SpringControllerFactory.Init(ObjectContainer.Context);
            SpringControllerFactory.RegisterControllerPath(Assembly.GetExecutingAssembly(), "SysCEF.Web.Controllers");
            ControllerBuilder.Current.SetControllerFactory(new SpringControllerFactory());

            DataAccess.DependencyConfigurator.ConfigureDependencies();
            DAO.DependencyConfigurator.ConfigureSqlRepositories();

            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
コード例 #2
0
        public static void ConfigureDependencies()
        {
            if (_IsConfigured)
            {
                return;
            }

            ObjectContainer.AddSingletonDefinition(typeof(IObjectContainer), typeof(ObjectContainer));
            ObjectContainer.AddSingletonDefinition(typeof(IUnitOfWorkFactory), typeof(UnitOfWorkFactory));
            ObjectContainer.AddPrototypeDefinition(typeof(IADOQuery), typeof(ADOQuery));
            ObjectContainer.AddPrototypeDefinition(typeof(IHQLQuery), typeof(HQLQuery));
            ObjectContainer.AddSingletonDefinition(typeof(IPersistenceBroker), typeof(PersistenceBroker));
            ObjectContainer.AddPrototypeDefinition(typeof(ISQLQuery), typeof(SQLQuery));
            ObjectContainer.AddSingletonDefinition(typeof(IUnitOfWorkFactory), typeof(UnitOfWorkFactory));

            _IsConfigured = true;
        }