Пример #1
0
 public void OnUninstalling(ModuleContext moduleContext, ControllerContext controllerContext)
 {
     var installationModel = new InstallationModel();
     if (Kooboo.CMS.Sites.Extension.ModelBindHelper.BindModel(installationModel, controllerContext))
     {
         try
         {
             _dbInitializer.DeleteDb(installationModel.ConnectionString);
         }
         catch (Exception e)
         {
             controllerContext.Controller.ViewData.ModelState.AddModelError("ConnectionString", e);
         }
     }
 }
Пример #2
0
 public void OnInstalling(ModuleContext moduleContext, ControllerContext controllerContext)
 {
     var installationModel = new InstallationModel();
     var connectString = controllerContext.HttpContext.Request.Form["ConnectionString"];
     if (Kooboo.CMS.Sites.Extension.ModelBindHelper.BindModel(installationModel, controllerContext))
     {
         try
         {
             _dbInitializer.InitializeDb(installationModel.ConnectionString);
             ModuleInfo moduleInfo = ModuleInfo.Get(ModuleAreaRegistration.ModuleName);
             moduleInfo.DefaultSettings.CustomSettings["ConnectionString"] = installationModel.ConnectionString;
             ModuleInfo.Save(moduleInfo);
         }
         catch (Exception e)
         {
             controllerContext.Controller.ViewData.ModelState.AddModelError("ConnectionString", e);
         }
     }
 }