public static IEnumerable <GenFormEnvironment> GetEnvironments(string machine)
        {
            var list = GenFormEnvironmentCollection.Create();

            if (!list.Any(e => e.MachineName == System.Environment.MachineName && e.Name == "TestGenForm"))
            {
                list.Add(GenFormEnvironment.CreateTest());
            }
            return(list.Where(e => e.MachineName == machine));
        }
        public static bool AddNewEnvironment(EnvironmentDto dto)
        {
            var list = GenFormEnvironmentCollection.Create();

            try
            {
                list.Add(GenFormEnvironment.Create(dto.Name, dto.provider, dto.Database, dto.LogPath, dto.ExportPath));
                return(true);
            }
            catch (System.Exception)
            {
                return(false);
            }
        }
示例#3
0
        private void GetEnvironment(string database, string logpath, string exportpath, string connectionstring, string provider)
        {
            _settings = GetIsolatedEnvironmentSettingsCollection();
            if (!string.IsNullOrWhiteSpace(database))
            {
                _settings.AddSetting(MachineName, EnvironmentName, database, provider, connectionstring);
            }
            if (!string.IsNullOrWhiteSpace(logpath))
            {
                _settings.AddSetting(MachineName, EnvironmentName, logpath, provider);
            }
            if (!string.IsNullOrWhiteSpace(exportpath))
            {
                _settings.AddSetting(MachineName, EnvironmentName, exportpath, provider);
            }

            _environment        = new Environment(MachineName, EnvironmentName, _settings);
            _genFormEnvironment = new GenFormEnvironment(_environment);
        }