HasConnectionString() public method

public HasConnectionString ( string name ) : bool
name string
return bool
Beispiel #1
0
        static bool CanBeResolvedFromEnvironmentSettings(EnvironmentSettings environmentSettings, Parameter parameter)
        {
            var name = parameter.Name;

            if (parameter.AllowAppSetting && environmentSettings.HasAppSetting(name))
            {
                return(true);
            }

            if (parameter.AllowConnectionString && environmentSettings.HasConnectionString(name))
            {
                return(true);
            }

            if (parameter.AllowEnvironmentVariable && environmentSettings.HasEnvironmentVariable(name))
            {
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        static void ResolveParametersFromEnvironmentSettings(EnvironmentSettings environmentSettings,
                                                             ICommand commandInstance, HashSet <Parameter> setParameters, IEnumerable <Parameter> parameters)
        {
            foreach (var parameter in parameters.Where(p => p.AllowAppSetting && !setParameters.Contains(p)))
            {
                if (!environmentSettings.HasAppSetting(parameter.Name))
                {
                    continue;
                }

                var appSettingValue = environmentSettings.GetAppSetting(parameter.Name);

                SetParameter(commandInstance, setParameters, parameter, appSettingValue);
            }

            foreach (var parameter in parameters.Where(p => p.AllowConnectionString && !setParameters.Contains(p)))
            {
                if (!environmentSettings.HasConnectionString(parameter.Name))
                {
                    continue;
                }

                var appSettingValue = environmentSettings.GetConnectionString(parameter.Name);

                SetParameter(commandInstance, setParameters, parameter, appSettingValue);
            }

            foreach (var parameter in parameters.Where(p => p.AllowEnvironmentVariable && !setParameters.Contains(p)))
            {
                if (!environmentSettings.HasEnvironmentVariable(parameter.Name))
                {
                    continue;
                }

                var appSettingValue = environmentSettings.GetEnvironmentVariable(parameter.Name);

                SetParameter(commandInstance, setParameters, parameter, appSettingValue);
            }
        }