Example #1
0
        public DependencyListOptions(Reports reports, CommandArgument path, CommandOption framework)
        {
            bool isInputValid = true;

            // reports
            Reports = reports;

            // project
            var projectPath = path.Value ?? Directory.GetCurrentDirectory();
            Runtime.Project projectOption;

            isInputValid &= Runtime.Project.TryGetProject(projectPath, out projectOption);
            Path = projectPath;
            Project = projectOption;

            // framework
            if (framework.HasValue())
            {
                try
                {
                    Framework = VersionUtility.ParseFrameworkName(framework.Value());
                }
                catch (ArgumentException ex)
                {
                    Reports.Error.WriteLine("Invalid framework name: {0}. [{1}]", framework.Value(), ex.Message);
                    isInputValid = false;
                }
            }
            else
            {
                Framework = null;
            }

            Valid = isInputValid;
        }
 private DbMigrationsConfiguration GetConfiguration(CommandOption connectionStringOption, CommandOption providerNameOption)
 {
     var connectionString = connectionStringOption.HasValue() ? connectionStringOption.Value() : null;
     var providerName = providerNameOption.HasValue() ? providerNameOption.Value() : null;
     return _migrator.GetConfiguration(connectionString, providerName: providerName);
 }