public static void StartApp() { IConfigSource configSource = new AppConfigSource(); App application = AppRuntime.Create(configSource); application.AppInitEvent += new App.AppInitHandle(application_AppInitEvent); application.Start(); }
protected void Application_Start(object sender, EventArgs e) { IConfigSource configSource = new AppConfigSource(); App application = AppRuntime.Create(configSource); application.AppInitEvent += new App.AppInitHandle(application_AppInitEvent); application.Start(); }
public void Setup() { //This might be dropped on the desktop to provide on the fly configuration overrides. People would likely just modify the app config //but in the event they don't want to alter it or simply wish to override a property or two this would allow for that. var txtSource = new TextFileConfigSource <SampleConfig>( @"C:\Users\Admin\Desktop\SampleText.ccs", ',', 1); //This is where we would typically get our configuration from. var dbSource = new KvpDbConfigSource <SampleConfig>( ConfigurationManager. ConnectionStrings["UAS Server"].ToString(), "TestCenterConfiguration", 2); //Of course if the DB is unavailable we might source our configuration from here. var appConfig = new AppConfigSource <SampleConfig>(3); var cfgProvider = new ConfigProvider <SampleConfig>(txtSource, dbSource, appConfig); cfgProvider.AllowIncompleteConfiguration = false; //Let's say for this particular implementation all values are absolutely essential and we should //throw an exception if they fail to populate over the course of iterating across our ConfigSources. cfgProvider.CascadingPopulate(); }
public SynchronizationServiceProc() { this.ServiceName = "TinyLibraryCQRS Synchronization Service"; this.EventLog.Log = "Application"; this.CanShutdown = true; this.CanStop = true; AppConfigSource configSource = new AppConfigSource(); IApp application = AppRuntime.Create(configSource); application.Initialize += (s, e) => { UnityContainer c = e.ObjectContainer.GetWrappedContainer <UnityContainer>(); IMessageDispatcher eventDispatcher = MessageDispatcher.CreateAndRegister(configSource, typeof(MessageDispatcher)); c.RegisterInstance <IMessageDispatcher>(eventDispatcher); }; application.Start(); messageDispatcher = AppRuntime.Instance.CurrentApplication.ObjectContainer.GetService <IMessageDispatcher>(); timer.Interval = this.Interval; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); worker.WorkerSupportsCancellation = true; worker.WorkerReportsProgress = false; worker.DoWork += new DoWorkEventHandler(worker_DoWork); }
/// <summary> /// Initializes a new instance of the <see cref="JsonConfigurationSource"/> class. /// </summary> /// <param name="exeName">The full path to the executable whose configuration must be loaded.</param> public AppConfigConfigurationSource(string exeName) { configuration = ConfigurationManager.OpenExeConfiguration(exeName); path = new FileInfo(exeName ?? throw new ArgumentNullException(nameof(exeName))); source = AppConfigSource.File; sync = new ReaderWriterLockSlim(); }
/// <summary> /// Initializes a new instance of the <see cref="AppConfigConfigurationSource" /> class. /// </summary> /// <param name="level">The configuration user level.</param> public AppConfigConfigurationSource(ConfigurationUserLevel level = ConfigurationUserLevel.None) { configuration = ConfigurationManager.OpenExeConfiguration(level); source = AppConfigSource.Default; sync = new ReaderWriterLockSlim(); userLevel = level; }
protected void Application_Start(object sender, EventArgs e) { IConfigSource appConfigSource = new AppConfigSource(); IApp application = AppRuntime.Create(appConfigSource); application.Initialize += new EventHandler <AppInitEventArgs>(application_Initialize); application.Start(); }
public void When_multiple_config_sources_are_selected() { var one = new AppConfigSource(); var two = new DictionarySource(new Dictionary <string, string>()); _config = new StronkConfig() .From.Source(one) .From.Source(two); _config.ConfigSources.ShouldBe(new IConfigurationSource[] { one, two }); }
public AppConfigSourceTests() { _source = new AppConfigSource(); }
/// <summary> /// Initializes a new instance of the <see cref="AppConfigConfigurationSource"/> class. /// </summary> /// <param name="config">The configuration.</param> /// <exception cref="System.ArgumentNullException">config</exception> public AppConfigConfigurationSource(Configuration config) { configuration = config ?? throw new ArgumentNullException(nameof(config)); source = AppConfigSource.Direct; sync = new ReaderWriterLockSlim(); }