/// <summary> /// Set applications /// </summary> private void setApplications() { // set data store ApplicationsWithConfiguration = new List <ApplicationConfigurationModel>(); // loop assemblies foreach (var assembly in _assemblies) { // find application types var appTypes = assembly.GetTypes().Where(x => x.IsSubclassOf(_appBaseType)); // loop them and add foreach (var appType in appTypes) { var rootConfig = new SingularApplicationConfigurationRoot(); var app = (SingularApplicationBase)Activator.CreateInstance(appType); rootConfig.Application = app; app.Configure(rootConfig); ApplicationsWithConfiguration.Add(new ApplicationConfigurationModel { Application = app, ConfigurationRoot = rootConfig }); } } // Set applications on this object Applications = ApplicationsWithConfiguration.Select(x => x.Application).ToList(); // Set admin sections on this object Sections = Applications.SelectMany(x => x.AdminSections).ToList(); // set controller installers Applications.ForEach(x => { if (x.ControllerInstaller != null) { AddControllerInstaller(x.ControllerInstaller); } }); // set web api controller installers Applications.ForEach(x => { if (x.WebApiControllerInstaller != null) { AddWebApiControllerInstaller(x.WebApiControllerInstaller); } }); // set app start methods AppStartMethods = Applications.Where(x => x.AppStartMethod != null).Select(x => x.AppStartMethod).ToList(); // node types NodeTypes = Applications.SelectMany(x => x.NodeTypes).OrderBy(x => x.Name).ToList(); foreach (var def in NodeTypes) { if (!string.IsNullOrEmpty(def.AllowedChildTypeMagicNames)) { var allowedTypes = new List <NodeTypeDefinition>(); foreach (var magicName in def.AllowedChildTypeMagicNames.Split(',')) { // find var found = NodeTypes.FirstOrDefault(x => x.MagicName == magicName); if (found != null) { allowedTypes.Add(found.SlowParameterlessConstructorClone()); } def.AllowedChildTypes = allowedTypes.OrderBy(x => x.Name).ToList(); } } } }
/// <summary> /// Configure /// </summary> /// <param name="config"></param> public abstract void Configure(SingularApplicationConfigurationRoot config);