public ActionResult IndexPOST(SetupViewModel model) { if (!ModelState.IsValid) { return IndexViewResult(model); } var setupContext = new SetupContext { SiteName = model.SiteName, EnabledFeatures = null, // default list }; var executionId = _setupService.Setup(setupContext); // redirect to the welcome page. return Redirect("~/" + _shellSettings.RequestUrlPrefix + "home/index"); }
public string Setup(SetupContext context) { string executionId = Guid.NewGuid().ToString(); // The vanilla Orchard distibution has the following features enabled. string[] hardcoded = { // Framework "OrchardVNext.Framework", // Core "Settings", // Test Modules "OrchardVNext.Demo", "OrchardVNext.Test1" }; context.EnabledFeatures = hardcoded.Union(context.EnabledFeatures ?? Enumerable.Empty<string>()).Distinct().ToList(); var shellSettings = new ShellSettings(_shellSettings); if (string.IsNullOrEmpty(shellSettings.DataProvider)) { shellSettings.DataProvider = context.DatabaseProvider; shellSettings.DataConnectionString = context.DatabaseConnectionString; shellSettings.DataTablePrefix = context.DatabaseTablePrefix; } // TODO: Add Encryption Settings in var shellDescriptor = new ShellDescriptor { Features = context.EnabledFeatures.Select(name => new ShellFeature { Name = name }) }; // creating a standalone environment. // in theory this environment can be used to resolve any normal components by interface, and those // components will exist entirely in isolation - no crossover between the safemode container currently in effect // must mark state as Running - otherwise standalone enviro is created "for setup" shellSettings.State = TenantState.Running; // TODO: Remove and mirror Orchard Setup shellSettings.RequestUrlHost = _httpContextAccessor.HttpContext.Request.Host.Value; shellSettings.DataProvider = "InMemory"; _shellSettingsManager.SaveSettings(shellSettings); return executionId; }