コード例 #1
0
        private static async Task <int> Apply(ApplyOptions opts)
        {
            var response = await Provisioner.ApplyTerraformRunAsync(opts.RunId);

            Console.WriteLine(response);
            return(0);
        }
コード例 #2
0
        public void GlobalOptionsApplyTest(string type)
        {
            string[]     args = GetArgs("apply", type);
            ApplyOptions opt  = TestParseArguments <ApplyOptions>(args);

            CheckFields(opt);
        }
コード例 #3
0
        public int RunApplyVerb(ApplyOptions opts)
        {
            instrumentationClient.InitializeSession(nameof(StateSynchronizationTask));
            Console.ResetColor();
            if (!string.IsNullOrWhiteSpace(opts.Directory))
            {
                if (Directory.Exists(opts.Directory))
                {
                    foreach (var spec in Directory.GetFiles(opts.Directory, "*.y*ml")
                             .Select(file => GetMetadata(opts, services, deserializer, file))
                             .OrderBy(metadata => metadata.Item1.Kind))
                    {
                        ProcessSpec(spec.Item3, spec.Item4, spec.Item1, spec.Item2);
                    }
                }
            }

            if (opts.ManifestFiles != null && opts.ManifestFiles.Any())
            {
                foreach (var file in opts.ManifestFiles)
                {
                    var spec = GetMetadata(opts, services, deserializer, file);
                    ProcessSpec(spec.Item3, spec.Item4, spec.Item1, spec.Item2);
                }
            }
            Console.ResetColor();
            instrumentationClient.FlushAsync().Wait();
            return(0);
        }
コード例 #4
0
ファイル: AccelGUI.cs プロジェクト: jev0n/rawaccel
        public void UpdateActiveSettingsFromFields()
        {
            var driverSettings = Settings.RawAccelSettings.AccelerationSettings;

            var settings = new DriverSettings
            {
                rotation    = ApplyOptions.Rotation.Field.Data,
                sensitivity = new Vec2 <double>
                {
                    x = ApplyOptions.Sensitivity.Fields.X,
                    y = ApplyOptions.Sensitivity.Fields.Y
                },
                combineMagnitudes = ApplyOptions.IsWhole,
                modes             = ApplyOptions.GetModes(),
                args        = ApplyOptions.GetArgs(),
                minimumTime = driverSettings.minimumTime
            };

            WriteButtonDelay();
            SettingsErrors errors = Settings.TryUpdateActiveSettings(settings);

            if (errors.Empty())
            {
                RefreshToggleStateFromNewSettings();
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                throw new Exception($"Bad arguments: \n {SettingsManager.ErrorStringFrom(errors)}");
            }
        }
コード例 #5
0
        public void Apply(ApplyOptions options)
        {
            if (!options.InternalAllClasses && string.IsNullOrWhiteSpace(options.LocalRootNamespace))
            {
                Console.WriteLine(options.SourceFolder);
            }
            else
            {
                Console.WriteLine(options.TransformedSourceFolder);
            }

            var    got = false;
            string originalNamespace = null;

            foreach (var line in File.ReadAllLines(options.OriginalProjectConfigs))
            {
                if (got)
                {
                    originalNamespace = line;
                    break;
                }
                if (line == "RootNamespace")
                {
                    got = true;
                }
            }

            FolderCopy.TransformFolderContents(options.SourceFolder, options.TransformedSourceFolder,
                                               (file, content) => TransformCode(file, content,
                                                                                originalNamespace, options.LocalRootNamespace,
                                                                                options.InternalAllClasses));
        }
コード例 #6
0
ファイル: AccelGUI.cs プロジェクト: termhn/rawaccel
        public AccelGUI(
            RawAcceleration accelForm,
            AccelCalculator accelCalculator,
            AccelCharts accelCharts,
            SettingsManager settings,
            ApplyOptions applyOptions,
            Button writeButton,
            ButtonBase toggleButton,
            MouseWatcher mouseWatcher,
            ToolStripMenuItem scaleMenuItem)
        {
            AccelForm         = accelForm;
            AccelCalculator   = accelCalculator;
            AccelCharts       = accelCharts;
            ApplyOptions      = applyOptions;
            WriteButton       = writeButton;
            ToggleButton      = (CheckBox)toggleButton;
            ScaleMenuItem     = scaleMenuItem;
            Settings          = settings;
            DefaultButtonFont = WriteButton.Font;
            SmallButtonFont   = new Font(WriteButton.Font.Name, WriteButton.Font.Size * Constants.SmallButtonSizeFactor);
            MouseWatcher      = mouseWatcher;

            ScaleMenuItem.Click   += new System.EventHandler(OnScaleMenuItemClick);
            WriteButton.Click     += new System.EventHandler(OnWriteButtonClick);
            ToggleButton.Click    += new System.EventHandler(OnToggleButtonClick);
            AccelForm.FormClosing += new FormClosingEventHandler(SaveGUISettingsOnClose);

            ButtonTimerInterval = Convert.ToInt32(DriverInterop.WriteDelayMs);
            ButtonTimer         = new Timer();
            ButtonTimer.Tick   += new System.EventHandler(OnButtonTimerTick);

            ChartRefresh = SetupChartTimer();

            bool settingsActive = Settings.Startup();

            SettingsNotDefault = !Settings.RawAccelSettings.IsDefaultEquivalent();

            if (settingsActive)
            {
                LastToggleChecked    = SettingsNotDefault;
                ToggleButton.Enabled = LastToggleChecked;
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                DriverSettings active           = DriverInterop.GetActiveSettings();
                bool           activeNotDefault = !RawAccelSettings.IsDefaultEquivalent(active);

                LastToggleChecked    = activeNotDefault;
                ToggleButton.Enabled = SettingsNotDefault || activeNotDefault;
                RefreshOnRead(active);
            }

            SetupButtons();
            AccelForm.DoResize();
        }
コード例 #7
0
ファイル: ActionApplyTest.cs プロジェクト: naidu-kjml/iasc
        public void RunActionTest()
        {
            var opt = new ApplyOptions();
            var act = new ActionApply();

            int status        = act.Run(opt);
            int lastRunStatus = act.GetLastRunStatus();

            Assert.AreEqual(status, lastRunStatus, "Status need to be the same!!!");
        }
コード例 #8
0
 private static Tuple <BaseSchema, string, TaskBase, string> GetMetadata(
     ApplyOptions opts, IServiceProvider services, IDeserializer deserializer, string file)
 {
     if (File.Exists(file))
     {
         var payload    = File.ReadAllText(file);
         var baseSchema = deserializer.Deserialize <BaseSchema>(payload);
         var service    = MappedApiServiceAttribute.GetApiServiceInstance(baseSchema.Kind, services);
         return(new Tuple <BaseSchema, string, TaskBase, string>(baseSchema, file, service, payload));
     }
     throw new InvalidOperationException("Manifest file couldn't be found or loaded.");
 }
コード例 #9
0
ファイル: MhoraOptions.cs プロジェクト: rahulyhg/mhora
        public MhoraOptions(Object a, ApplyOptions o, bool NoCancel)
        {
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            pGrid.SelectedObject = new GlobalizedPropertiesWrapper(a);
            pGrid.HelpVisible    = true;
            applyEvent           = o;
            this.bCancel.Enabled = false;
        }
コード例 #10
0
ファイル: MhoraOptions.cs プロジェクト: rahulyhg/mhora
        public MhoraOptions(Object a, ApplyOptions o)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            pGrid.SelectedObject = new GlobalizedPropertiesWrapper(a);
            applyEvent           = o;
            //this.applyEvent(pGrid.SelectedObject);
        }
コード例 #11
0
        public void UpdateActiveSettingsFromFields()
        {
            var driverSettings = Settings.RawAccelSettings.AccelerationSettings;

            var newArgs = ApplyOptions.GetArgs();

            newArgs.x.speedCap = driverSettings.args.x.speedCap;
            newArgs.y.speedCap = driverSettings.args.y.speedCap;

            var settings = new DriverSettings
            {
                rotation    = ApplyOptions.Rotation.Field.Data,
                snap        = driverSettings.snap,
                sensitivity = new Vec2 <double>
                {
                    x = ApplyOptions.Sensitivity.Fields.X,
                    y = ApplyOptions.Sensitivity.Fields.Y
                },
                combineMagnitudes = ApplyOptions.IsWhole,
                modes             = ApplyOptions.GetModes(),
                args                   = newArgs,
                minimumTime            = driverSettings.minimumTime,
                directionalMultipliers = driverSettings.directionalMultipliers,
                domainArgs             = ApplyOptions.Directionality.GetDomainArgs(),
                rangeXY                = ApplyOptions.Directionality.GetRangeXY(),
                deviceID               = DeviceIDManager.ID,
            };

            ButtonDelay(WriteButton);
            SettingsErrors errors = Settings.TryUpdateActiveSettings(settings);

            if (errors.Empty())
            {
                SettingsNotDefault = !Settings.RawAccelSettings.IsDefaultEquivalent();
                LastToggleChecked  = SettingsNotDefault;
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                new MessageDialog(errors.ToString(), "bad input").ShowDialog();
            }
        }
コード例 #12
0
ファイル: AccelGUI.cs プロジェクト: termhn/rawaccel
        public void UpdateActiveSettingsFromFields()
        {
            var driverSettings = Settings.RawAccelSettings.AccelerationSettings;

            var newArgs = ApplyOptions.GetArgs();

            newArgs.x.speedCap = driverSettings.args.x.speedCap;
            newArgs.y.speedCap = driverSettings.args.y.speedCap;

            var settings = new DriverSettings
            {
                rotation    = ApplyOptions.Rotation.Field.Data,
                sensitivity = new Vec2 <double>
                {
                    x = ApplyOptions.Sensitivity.Fields.X,
                    y = ApplyOptions.Sensitivity.Fields.Y
                },
                combineMagnitudes = ApplyOptions.IsWhole,
                modes             = ApplyOptions.GetModes(),
                args                   = newArgs,
                minimumTime            = driverSettings.minimumTime,
                directionalMultipliers = driverSettings.directionalMultipliers
            };

            ButtonDelay(WriteButton);
            SettingsErrors errors = Settings.TryUpdateActiveSettings(settings);

            if (errors.Empty())
            {
                SettingsNotDefault = !Settings.RawAccelSettings.IsDefaultEquivalent();
                LastToggleChecked  = SettingsNotDefault;
                RefreshOnRead(Settings.RawAccelSettings.AccelerationSettings);
            }
            else
            {
                throw new Exception($"Bad arguments:\n\n{errors}");
            }
        }
コード例 #13
0
        public int RunApplyVerb(ApplyOptions opts)
        {
            var deserializer = new DeserializerBuilder()
                               .WithNamingConvention(new CamelCaseNamingConvention())
                               .IgnoreUnmatchedProperties()
                               .Build();

            foreach (var file in opts.ManifestFiles)
            {
                if (File.Exists(file))
                {
                    var payload    = File.ReadAllText(file);
                    var baseSchema = deserializer.Deserialize <BaseSchema>(payload);
                    MappedApiServiceAttribute
                    .GetApiServiceInstance(baseSchema.Kind,
                                           opts.OrganizationURL,
                                           opts.PAT)
                    .ExecuteAsync(baseSchema, payload).Wait();
                }
            }
            Console.ResetColor();
            return(0);
        }
コード例 #14
0
 private static void ApplyAndReturnExitCode(ApplyOptions options)
 {
     new TransformCodeFlow().Apply(options);
 }
コード例 #15
0
ファイル: AccelGUIFactory.cs プロジェクト: Toxicoria/rawaccel
        public static AccelGUI Construct(
            RawAcceleration form,
            ManagedAccel activeAccel,
            Chart accelerationChart,
            Chart accelerationChartY,
            Chart velocityChart,
            Chart velocityChartY,
            Chart gainChart,
            Chart gainChartY,
            ComboBox accelTypeDropX,
            ComboBox accelTypeDropY,
            Button writeButton,
            ButtonBase toggleButton,
            ToolStripMenuItem showVelocityGainToolStripMenuItem,
            ToolStripMenuItem showLastMouseMoveMenuItem,
            ToolStripMenuItem wholeVectorToolStripMenuItem,
            ToolStripMenuItem byVectorComponentToolStripMenuItem,
            ToolStripMenuItem velocityGainCapToolStripMenuItem,
            ToolStripMenuItem legacyCapToolStripMenuItem,
            ToolStripMenuItem gainOffsetToolStripMenuItem,
            ToolStripMenuItem legacyOffsetToolStripMenuItem,
            ToolStripMenuItem autoWriteMenuItem,
            ToolStripMenuItem scaleMenuItem,
            ToolStripTextBox dpiTextBox,
            ToolStripTextBox pollRateTextBox,
            TextBox sensitivityBoxX,
            TextBox sensitivityBoxY,
            TextBox rotationBox,
            TextBox weightBoxX,
            TextBox weightBoxY,
            TextBox capBoxX,
            TextBox capBoxY,
            TextBox offsetBoxX,
            TextBox offsetBoxY,
            TextBox accelerationBoxX,
            TextBox accelerationBoxY,
            TextBox scaleBoxX,
            TextBox scaleBoxY,
            TextBox limitBoxX,
            TextBox limitBoxY,
            TextBox expBoxX,
            TextBox expBoxY,
            TextBox midpointBoxX,
            TextBox midpointBoxY,
            CheckBox sensXYLock,
            CheckBox byComponentXYLock,
            Label lockXYLabel,
            Label sensitivityLabel,
            Label rotationLabel,
            Label weightLabelX,
            Label weightLabelY,
            Label capLabelX,
            Label capLabelY,
            Label offsetLabelX,
            Label offsetLabelY,
            Label constantOneLabelX,
            Label constantOneLabelY,
            Label scaleLabelX,
            Label scaleLabelY,
            Label limitLabelX,
            Label limitLabelY,
            Label expLabelX,
            Label expLabelY,
            Label constantThreeLabelX,
            Label constantThreeLabelY,
            Label activeValueTitleX,
            Label activeValueTitleY,
            Label sensitivityActiveXLabel,
            Label sensitivityActiveYLabel,
            Label rotationActiveLabel,
            Label weightActiveXLabel,
            Label weightActiveYLabel,
            Label capActiveXLabel,
            Label capActiveYLabel,
            Label offsetActiveLabelX,
            Label offsetActiveLabelY,
            Label accelerationActiveLabelX,
            Label accelerationActiveLabelY,
            Label scaleActiveLabelX,
            Label scaleActiveLabelY,
            Label limitActiveLabelX,
            Label limitActiveLabelY,
            Label expActiveLabelX,
            Label expActiveLabelY,
            Label midpointActiveLabelX,
            Label midpointActiveLabelY,
            Label accelTypeActiveLabelX,
            Label accelTypeActiveLabelY,
            Label optionSetXTitle,
            Label optionSetYTitle,
            Label mouseLabel)
        {
            var accelCalculator = new AccelCalculator(
                new Field(dpiTextBox.TextBox, form, Constants.DefaultDPI),
                new Field(pollRateTextBox.TextBox, form, Constants.DefaultPollRate));

            var accelCharts = new AccelCharts(
                form,
                new ChartXY(accelerationChart, accelerationChartY, Constants.SensitivityChartTitle),
                new ChartXY(velocityChart, velocityChartY, Constants.VelocityChartTitle),
                new ChartXY(gainChart, gainChartY, Constants.GainChartTitle),
                showVelocityGainToolStripMenuItem,
                showLastMouseMoveMenuItem,
                writeButton,
                accelCalculator);

            var sensitivity = new OptionXY(
                sensitivityBoxX,
                sensitivityBoxY,
                sensXYLock,
                form,
                1,
                sensitivityLabel,
                new ActiveValueLabelXY(
                    new ActiveValueLabel(sensitivityActiveXLabel, activeValueTitleX),
                    new ActiveValueLabel(sensitivityActiveYLabel, activeValueTitleX)),
                "Sens Multiplier");

            var rotation = new Option(
                rotationBox,
                form,
                0,
                rotationLabel,
                0,
                new ActiveValueLabel(rotationActiveLabel, activeValueTitleX),
                "Rotation");

            var optionSetYLeft = rotation.Left + rotation.Width;

            var weightX = new Option(
                weightBoxX,
                form,
                1,
                weightLabelX,
                0,
                new ActiveValueLabel(weightActiveXLabel, activeValueTitleX),
                "Weight");

            var weightY = new Option(
                weightBoxY,
                form,
                1,
                weightLabelY,
                optionSetYLeft,
                new ActiveValueLabel(weightActiveYLabel, activeValueTitleY),
                "Weight");

            var capX = new Option(
                capBoxX,
                form,
                0,
                capLabelX,
                0,
                new ActiveValueLabel(capActiveXLabel, activeValueTitleX),
                "Cap");

            var capY = new Option(
                capBoxY,
                form,
                0,
                capLabelY,
                optionSetYLeft,
                new ActiveValueLabel(capActiveYLabel, activeValueTitleY),
                "Cap");

            var offsetX = new Option(
                offsetBoxX,
                form,
                0,
                offsetLabelX,
                0,
                new ActiveValueLabel(offsetActiveLabelX, activeValueTitleX),
                "Offset");

            var offsetY = new Option(
                offsetBoxY,
                form,
                0,
                offsetLabelY,
                optionSetYLeft,
                new ActiveValueLabel(offsetActiveLabelY, activeValueTitleY),
                "Offset");

            var offsetOptionsX = new OffsetOptions(
                gainOffsetToolStripMenuItem,
                legacyOffsetToolStripMenuItem,
                offsetX);

            var offsetOptionsY = new OffsetOptions(
                gainOffsetToolStripMenuItem,
                legacyOffsetToolStripMenuItem,
                offsetY);

            var accelerationX = new Option(
                new Field(accelerationBoxX, form, 0),
                constantOneLabelX,
                new ActiveValueLabel(accelerationActiveLabelX, activeValueTitleX),
                0);

            var accelerationY = new Option(
                new Field(accelerationBoxY, form, 0),
                constantOneLabelY,
                new ActiveValueLabel(accelerationActiveLabelY, activeValueTitleY),
                optionSetYLeft);

            var scaleX = new Option(
                new Field(scaleBoxX, form, 0),
                scaleLabelX,
                new ActiveValueLabel(scaleActiveLabelX, activeValueTitleX),
                0);

            var scaleY = new Option(
                new Field(scaleBoxY, form, 0),
                scaleLabelY,
                new ActiveValueLabel(scaleActiveLabelY, activeValueTitleY),
                optionSetYLeft);

            var limitX = new Option(
                new Field(limitBoxX, form, 2),
                limitLabelX,
                new ActiveValueLabel(limitActiveLabelX, activeValueTitleX),
                0);

            var limitY = new Option(
                new Field(limitBoxY, form, 2),
                limitLabelY,
                new ActiveValueLabel(limitActiveLabelY, activeValueTitleY),
                optionSetYLeft);

            var exponentX = new Option(
                new Field(expBoxX, form, 2),
                expLabelX,
                new ActiveValueLabel(expActiveLabelX, activeValueTitleX),
                0);

            var exponentY = new Option(
                new Field(expBoxY, form, 2),
                expLabelY,
                new ActiveValueLabel(expActiveLabelY, activeValueTitleY),
                optionSetYLeft);

            var midpointX = new Option(
                new Field(midpointBoxX, form, 0),
                constantThreeLabelX,
                new ActiveValueLabel(midpointActiveLabelX, activeValueTitleX),
                0);

            var midpointY = new Option(
                new Field(midpointBoxY, form, 0),
                constantThreeLabelY,
                new ActiveValueLabel(midpointActiveLabelY, activeValueTitleY),
                optionSetYLeft);

            var capOptionsX = new CapOptions(
                velocityGainCapToolStripMenuItem,
                legacyCapToolStripMenuItem,
                capX);

            var capOptionsY = new CapOptions(
                velocityGainCapToolStripMenuItem,
                legacyCapToolStripMenuItem,
                capY);

            var accelerationOptionsX = new AccelTypeOptions(
                accelTypeDropX,
                accelerationX,
                scaleX,
                capOptionsX,
                weightX,
                offsetOptionsX,
                limitX,
                exponentX,
                midpointX,
                writeButton,
                new ActiveValueLabel(accelTypeActiveLabelX, activeValueTitleX));

            var accelerationOptionsY = new AccelTypeOptions(
                accelTypeDropY,
                accelerationY,
                scaleY,
                capOptionsY,
                weightY,
                offsetOptionsY,
                limitY,
                exponentY,
                midpointY,
                writeButton,
                new ActiveValueLabel(accelTypeActiveLabelY, activeValueTitleY));

            var optionsSetX = new AccelOptionSet(
                optionSetXTitle,
                activeValueTitleX,
                rotationBox.Top + rotationBox.Height + Constants.OptionVerticalSeperation,
                accelerationOptionsX);

            var optionsSetY = new AccelOptionSet(
                optionSetYTitle,
                activeValueTitleY,
                rotationBox.Top + rotationBox.Height + Constants.OptionVerticalSeperation,
                accelerationOptionsY);

            var applyOptions = new ApplyOptions(
                wholeVectorToolStripMenuItem,
                byVectorComponentToolStripMenuItem,
                byComponentXYLock,
                optionsSetX,
                optionsSetY,
                sensitivity,
                rotation,
                lockXYLabel,
                accelCharts);

            var settings = new SettingsManager(
                activeAccel,
                accelCalculator.DPI,
                accelCalculator.PollRate,
                autoWriteMenuItem,
                showLastMouseMoveMenuItem,
                showVelocityGainToolStripMenuItem);

            var mouseWatcher = new MouseWatcher(form, mouseLabel, accelCharts, accelCalculator.PollRate);

            return(new AccelGUI(
                       form,
                       accelCalculator,
                       accelCharts,
                       settings,
                       applyOptions,
                       writeButton,
                       toggleButton,
                       mouseWatcher,
                       scaleMenuItem));
        }
コード例 #16
0
ファイル: AccelGUI.cs プロジェクト: termhn/rawaccel
 public void UpdateShownActiveValues(DriverSettings args)
 {
     AccelForm.ResetAutoScroll();
     AccelCharts.ShowActive(args);
     ApplyOptions.SetActiveValues(args);
 }
コード例 #17
0
        private void apply_Click(object sender, EventArgs e)
        {
            SaveSettings();

            ApplyOptions?.Invoke(this, Options);
        }
コード例 #18
0
        public void Apply(ApplyOptions options) {
            if (IsEmpty)
                return;

            using (var database = new SettingsProviderDatabase()) {
                var section = database.Sections.FirstOrDefault(s => s.Name == Section);
                if (section == null) {
                    section = new Section() { Name = Section, AssemblyName = Assembly };
                    database.AddToSections(section);
                }

                foreach (Action action in Actions) {
                    switch (action.Type) {
                        case Action.ActionType.Insert:
                            if (action.IsConnectionString) 
                                InsertConnectionString(options, database, section, action);
                            else 
                                InsertApplcationSetting(section, action);
                            break;
                        case Action.ActionType.Delete:
                            if (action.IsConnectionString) {
                                var names = from connectionName in database.SqlConnectionNames.Include("Section")
                                            where connectionName.Section.Id == section.Id && connectionName.Name == action.Name
                                            select connectionName;
                                foreach (var name in names) database.DeleteObject(name);
                            } else {
                                var settings = from setting in database.ApplicationSettings
                                               where setting.SectionId == section.Id && setting.Name == action.Name
                                               select setting;
                                foreach (var name in settings) database.DeleteObject(name);
                            }
                            break;
                        case Action.ActionType.Update:
                            if (action.IsConnectionString) {
                                SqlConnectionString connection = database.SqlConnectionNames
                                    .Include("Section")
                                    .Include("SqlConnectionString")
                                    .Where(sec => sec.Section.Id == section.Id)
                                    .Select(sec => sec.SqlConnectionString)
                                    .FirstOrDefault();
                                if(connection != null)
                                    connection.ConnectionString = action.Value;
                            } else {
                                ApplicationSetting setting = database.ApplicationSettings
                                    .Include("Section")
                                    .Where(s => s.Section.Id == section.Id && s.Name == action.Name)
                                    .FirstOrDefault();
                                if (setting != null)
                                    setting.Value = action.Value;
                            }
                            break;
                    }
                }
                database.SaveChanges();
            }
        }
コード例 #19
0
        private static void InsertConnectionString(ApplyOptions options, SettingsProviderDatabase database, SettingsProvider.Section section, Action action) {
            var name = new SqlConnectionName() {
                Name = action.Name
            };

            SqlConnectionString connection = null;
            if (!options.UseExistingConnectionStrings) {
                connection = database.SqlConnectionStrings.FirstOrDefault(c => c.ConnectionString == action.Value);
            }
            if (connection == null) {
                connection = new SqlConnectionString() {
                    ConnectionString = action.Value
                };
                database.AddToSqlConnectionStrings(connection);
            }

            database.AddToSqlConnectionNames(name);

            name.Section = section;
            name.SqlConnectionString = connection;
        }