private void initPersistence(bool configureModules = true) { IPersistenceManager pManager = PersistenceFactory.GetPersistenceManager(); // just to prepare data access environment pManager.Configure(AppConfiguration.DefaultApplicationConnection.ConnectionString, AppConfiguration.DatabaseDialect, "Default", AppConfiguration.ShowQueries, configureModules); if (AppConfiguration.CreateDatabase) { pManager.ExportSchema(); } pManager.Start(); // If there is any active module in catalong at the DB creation time, it would be automatically installed. // Installation means, the modules' Install method is called, which usually generates the seed data if (AppConfiguration.CreateDatabase) { IModuleSeedDataGenerator shellSeedDataGenerator = IoCFactory.Container.Resolve <IModuleSeedDataGenerator>(); shellSeedDataGenerator.GenerateSeedData(); installModuleOnFreshDatabase(); } // if there are pending modules, their schema (if exists) must be applied. else if (ModuleManager.HasPendingInstallation()) { insatllPendingModules(pManager); } }
protected void Application_Start() { IoCFactory.StartContainer(Path.Combine(AppConfiguration.AppRoot, "IoC.config"), "DefaultContainer", HttpContext.Current); // use AppConfig to access the app root folder //loadModules(); IPersistenceManager pManager = PersistenceFactory.GetPersistenceManager(); // just to prepare data access environment pManager.Configure(AppConfiguration.DefaultApplicationConnection.ConnectionString, AppConfiguration.DatabaseDialect); //, AppConfiguration.DefaultApplicationConnection.ConnectionString); if (AppConfiguration.CreateDatabase) { pManager.ExportSchema(); } pManager.Start(); AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); ITenantResolver tenantResolver = IoCFactory.Container.Resolve <ITenantResolver>(); ITenantPathProvider pathProvider = new DefaultTenantPathProvider(); // should be instantiated by the IoC. client app should provide the Path Ptovider based on its file and tenant structure tenantResolver.Load(pathProvider); var x = tenantResolver.Manifest; }