/// <summary> /// Initialize components and plugins in the Nas environment. /// </summary> /// <param name="config">Config</param> public void Initialize(NasConfig config) { bool databaseInstalled = DataSettingsHelper.DatabaseIsInstalled(); if (databaseInstalled) { //startup tasks RunStartupTasks(); } }
/// <summary> /// Creates a factory instance and adds a http application injecting facility. /// </summary> /// <returns>A new factory</returns> public static IEngine CreateEngineInstance(NasConfig config) { if (config != null && !string.IsNullOrEmpty(config.EngineType)) { var engineType = Type.GetType(config.EngineType); if (engineType == null) { throw new ConfigurationErrorsException("The type '" + engineType + "' could not be found. Please check the configuration at /configuration/Nas/engine[@engineType] or check for missing assemblies."); } if (!typeof(IEngine).IsAssignableFrom(engineType)) { throw new ConfigurationErrorsException("The type '" + engineType + "' doesn't implement 'Nas.Core.Infrastructure.IEngine' and cannot be configured in /configuration/Nas/engine[@engineType] for that purpose."); } return(Activator.CreateInstance(engineType) as IEngine); } return(new NasEngine()); }
private void InitializeContainer(ContainerConfigurer configurer, EventBroker broker, NasConfig config) { var builder = new ContainerBuilder(); _containerManager = new ContainerManager(builder.Build()); configurer.Configure(this, _containerManager, broker, config); }
public UpdateServiceRequest(string serviceName, string description = "", string role = null, LogConfig logConfig = null, bool internetAccess = true, VpcConfig vpcConfig = null, NasConfig nasConfig = null, Dictionary <string, string> customHeaders = null) { Contract.Requires(string.IsNullOrEmpty(serviceName) == false); this.ServiceName = serviceName; this.UpdateServiceMeta = new UpdateServiceMeta(description, role, logConfig, internetAccess, vpcConfig, nasConfig); this.Headers = customHeaders; }
public virtual void Configure(IEngine engine, ContainerManager containerManager, EventBroker broker, NasConfig configuration) { //other dependencies containerManager.AddComponentInstance <NasConfig>(configuration, "Nas.configuration"); containerManager.AddComponentInstance <IEngine>(engine, "Nas.engine"); containerManager.AddComponentInstance <ContainerConfigurer>(this, "Nas.containerConfigurer"); //type finder containerManager.AddComponent <ITypeFinder, WebAppTypeFinder>("Nas.typeFinder"); //register dependencies provided by other assemblies var typeFinder = containerManager.Resolve <ITypeFinder>(); containerManager.UpdateContainer(x => { var drTypes = typeFinder.FindClassesOfType <IDependencyRegistrar>(); var drInstances = new List <IDependencyRegistrar>(); foreach (var drType in drTypes) { drInstances.Add((IDependencyRegistrar)Activator.CreateInstance(drType)); } //sort drInstances = drInstances.AsQueryable().OrderBy(t => t.Order).ToList(); foreach (var dependencyRegistrar in drInstances) { dependencyRegistrar.Register(x, typeFinder); } }); //event broker containerManager.AddComponentInstance(broker); }
public ThemeProvider(NasConfig NasConfig, IWebHelper webHelper) { basePath = webHelper.MapPath(NasConfig.ThemeBasePath); LoadConfigurations(); }