/// <summary> /// Execute the change /// </summary> public bool Execute(SanteDBConfiguration configuration) { var dsi = new DataInitializationService(); dsi.ProgressChanged += (o, e) => this.ProgressChanged?.Invoke(o, e); dsi.InstallDataset(this.m_dataset); File.Move(this.m_file, Path.ChangeExtension(m_file, "completed")); return(true); }
/// <summary> /// Fired after applying updates /// </summary> public void AfterUpdate() { // Update the configuration ApplicationContext.Current.GetService <FileConfigurationService>().Open(ConfigurationApplicationContext.s_configFile); if (ApplicationContext.Current.GetService <IDataPersistenceService <Entity> >() == null) { ApplicationContext.Current.AddServiceProvider(typeof(AdoPersistenceService)); ApplicationContext.Current.GetService <AdoPersistenceService>().Start(); } // Check the directory for datasets to install var dsi = new DataInitializationService(); dsi.ProgressChanged += (o, e) => this.ProgressChanged?.Invoke(this, new ProgressChangedEventArgs((int)(e.Progress * 100), e.State)); dsi.InstallDataDirectory((o, e) => this.ProgressChanged?.Invoke(this, new ProgressChangedEventArgs((int)(e.Progress * 100), null))); }
public static void Install(string[] args) { // Load the file var parms = new ParameterParser <InstallParameters>().Parse(args); ApplicationContext.Current.Start(); var dsi = new DataInitializationService(); var ds = DatasetInstall.Load(parms.DatasetFile); Console.WriteLine("Will install dataset {0} ({1} objects)...", ds.Action.Count, ds.Id); dsi.ProgressChanged += (o, e) => { Console.CursorLeft = 4; Console.Write("{0} ({1:0%})", e.State, e.Progress); }; dsi.InstallDataset(ds); }