示例#1
0
        public Executor([NotNull] IDictionary args)
        {
            Check.NotNull(args, "args");

            _targetDir      = (string)args["targetDir"];
            _targetFileName = (string)args["targetFileName"];
            _projectDir     = (string)args["projectDir"];
            _rootNamespace  = (string)args["rootNamespace"];

            // TODO: Use _projectDir & _rootNamespace
            _migrationTool = new MigrationTool();
        }
示例#2
0
        protected virtual IConfigurationSourceContainer CreateConfiguration(
            MigrationTool tool, CommandCode commandCode, string[] commandArgs)
        {
            var configuration = CreateConfiguration();

            CommandLineConfigurationSource commandLineConfigSource;
            string configFile;

            if (commandArgs != null &&
                commandArgs.Any())
            {
                commandLineConfigSource = new CommandLineConfigurationSource(commandArgs);
                commandLineConfigSource.Load();
                commandLineConfigSource.TryGet(MigrationTool.Constants.ConfigFileOption, out configFile);
            }
            else
            {
                commandLineConfigSource = null;
                configFile = null;
            }

            if (commandCode != CommandCode.CommitConfiguration)
            {
                if (!string.IsNullOrEmpty(configFile))
                {
                    configuration.AddIniFile(tool.ResolvePath(configFile));
                }
                else
                {
                    configFile = tool.ResolvePath(MigrationTool.Constants.DefaultConfigFile);
                    if (File.Exists(configFile))
                    {
                        configuration.AddIniFile(configFile);
                    }
                }
            }

            if (commandLineConfigSource != null)
            {
                configuration.Add(commandLineConfigSource);
            }

            return(configuration);
        }
示例#3
0
        protected virtual IConfigurationSourceContainer CreateConfiguration(
            MigrationTool tool, CommandCode commandCode, string[] commandArgs)
        {
            var configuration = CreateConfiguration();

            CommandLineConfigurationSource commandLineConfigSource;
            string configFile;

            if (commandArgs != null && commandArgs.Any())
            {
                commandLineConfigSource = new CommandLineConfigurationSource(commandArgs);
                commandLineConfigSource.Load();
                commandLineConfigSource.TryGet(MigrationTool.Constants.ConfigFileOption, out configFile);
            }
            else
            {
                commandLineConfigSource = null;
                configFile = null;
            }

            if (commandCode != CommandCode.CommitConfiguration)
            {
                if (!string.IsNullOrEmpty(configFile))
                {
                    configuration.AddIniFile(tool.ResolvePath(configFile));
                }
                else
                {
                    configFile = tool.ResolvePath(MigrationTool.Constants.DefaultConfigFile);
                    if (File.Exists(configFile))
                    {
                        configuration.AddIniFile(configFile);
                    }
                }
            }

            if (commandLineConfigSource != null)
            {
                configuration.Add(commandLineConfigSource);
            }

            return configuration;
        }