Пример #1
0
 /// <summary>
 /// Check parameters
 /// </summary>
 public void Check()
 {
     if (!AvailableProductTypes.Contains(ProjectType))
     {
         throw new ArgumentException(
                   "Project type must be one of " +
                   string.Join(", ", AvailableProductTypes));
     }
     else if (string.IsNullOrEmpty(ProjectName))
     {
         throw new ArgumentException("Project name can't be empty");
     }
     else if (!AvailableORM.Contains(ORM))
     {
         throw new ArgumentException(
                   "ORM must be one of " +
                   string.Join(", ", AvailableORM));
     }
     else if (!AvailableDatabases[ORM].Contains(Database))
     {
         throw new ArgumentException(
                   "Database must be one of " +
                   string.Join(", ", AvailableDatabases[ORM]));
     }
     else if (string.IsNullOrEmpty(ConnectionString))
     {
         throw new ArgumentException("Connection string can't be empty");
     }
     else if (string.IsNullOrEmpty(OutputDirectory))
     {
         throw new ArgumentException("Output directory can't be empty");
     }
     if (!string.IsNullOrEmpty(UseDefaultPlugins))
     {
         var pluginCollection = PluginCollection.FromFile(UseDefaultPlugins);
         if (!pluginCollection.SupportedORM.Any(o =>
                                                string.Equals(o, ORM, StringComparison.OrdinalIgnoreCase)))
         {
             throw new ArgumentException(
                       "This plugin collection only support following ORM: " +
                       string.Join(", ", pluginCollection.SupportedORM));
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Check parameters
 /// </summary>
 public void Check()
 {
     if (!AvailableProductTypes.Contains(ProjectType))
     {
         throw new ArgumentException(
                   Resources.ProjectTypeMustBeOneOf +
                   string.Join(", ", AvailableProductTypes));
     }
     else if (string.IsNullOrEmpty(ProjectName))
     {
         throw new ArgumentException(Resources.ProjectNameCantBeEmpty);
     }
     else if (!AvailableORM.Contains(ORM))
     {
         throw new ArgumentException(
                   Resources.ORMMustBeOneOf +
                   string.Join(", ", AvailableORM));
     }
     else if (!AvailableDatabases[ORM].Contains(Database))
     {
         throw new ArgumentException(
                   Resources.DatabaseMustBeOneOf +
                   string.Join(", ", AvailableDatabases[ORM]));
     }
     else if (string.IsNullOrEmpty(ConnectionString))
     {
         throw new ArgumentException(Resources.ConnectionStringCantBeEmpty);
     }
     else if (string.IsNullOrEmpty(OutputDirectory))
     {
         throw new ArgumentException(Resources.OutputDirectoryCantBeEmpty);
     }
     if (!string.IsNullOrEmpty(UseDefaultPlugins))
     {
         var pluginCollection = PluginCollection.FromFile(UseDefaultPlugins);
         if (!pluginCollection.SupportedORM.Any(o =>
                                                string.Equals(o, ORM, StringComparison.OrdinalIgnoreCase)))
         {
             throw new ArgumentException(
                       Resources.ThisPluginCollectionOnlySupportTheseORM +
                       string.Join(", ", pluginCollection.SupportedORM));
         }
     }
 }