Esempio n. 1
0
 public void ThrowWarningsIfWarningsAsErrors()
 {
     if (MissingColumns && WarningsAsErrors)
     {
         if (this.Warnings.MissingForeignKeyColumns.Length > 0)
         {
             List <string> missingColumns = new List <string>();
             foreach (ForeignKeyColumn fk in this.Warnings.MissingForeignKeyColumns)
             {
                 DaoRepositorySchemaWarningEventArgs drswea = GetEventArgs(fk);
                 missingColumns.Add("{ClassName}.{PropertyName}".NamedFormat(drswea));
             }
             throw new MissingForeignKeyPropertyException(missingColumns);
         }
         if (this.Warnings.MissingKeyColumns.Length > 0)
         {
             List <string> classNames = new List <string>();
             foreach (KeyColumn k in this.Warnings.MissingKeyColumns)
             {
                 DaoRepositorySchemaWarningEventArgs drswea = GetEventArgs(k);
                 classNames.Add(k.TableClassName);
             }
             throw new NoIdPropertyException(classNames);
         }
     }
 }
Esempio n. 2
0
        private static DaoRepositorySchemaWarningEventArgs GetEventArgs(KeyColumn keyColumn)
        {
            string className = keyColumn.TableClassName;
            DaoRepositorySchemaWarningEventArgs drswea = new DaoRepositorySchemaWarningEventArgs {
                ClassName = className, PropertyName = "Id", PropertyType = "key column"
            };

            return(drswea);
        }
Esempio n. 3
0
        private static DaoRepositorySchemaWarningEventArgs GetEventArgs(ForeignKeyColumn fk)
        {
            string referencingClassName = fk.ReferencingClass.EndsWith("Dao") ? fk.ReferencingClass.Truncate(3) : fk.ReferencingClass;
            string propertyName         = fk.PropertyName;
            DaoRepositorySchemaWarningEventArgs drswea = new DaoRepositorySchemaWarningEventArgs {
                ClassName = referencingClassName, PropertyName = propertyName, PropertyType = "foreign key"
            };

            return(drswea);
        }
Esempio n. 4
0
 protected internal void EmitWarnings()
 {
     if (MissingColumns)
     {
         if (this.Warnings.MissingForeignKeyColumns.Length > 0)
         {
             foreach (ForeignKeyColumn fk in this.Warnings.MissingForeignKeyColumns)
             {
                 DaoRepositorySchemaWarningEventArgs drswea = GetEventArgs(fk);
                 FireEvent(SchemaWarning, drswea);
             }
         }
         if (this.Warnings.MissingKeyColumns.Length > 0)
         {
             foreach (KeyColumn keyColumn in this.Warnings.MissingKeyColumns)
             {
                 DaoRepositorySchemaWarningEventArgs drswea = GetEventArgs(keyColumn);
                 FireEvent(SchemaWarning, drswea);
             }
         }
     }
 }