本文整理汇总了C#中ValidationResult.AddInvalidColumn方法的典型用法代码示例。如果您正苦于以下问题:C# ValidationResult.AddInvalidColumn方法的具体用法?C# ValidationResult.AddInvalidColumn怎么用?C# ValidationResult.AddInvalidColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValidationResult
的用法示例。
在下文中一共展示了ValidationResult.AddInvalidColumn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateSchema
public ValidationResult ValidateSchema(Dialect dialect, DatabaseMetadata databaseMetadata)
{
_configuration.BuildMappings();
var mappings = _configuration.CreateMappings(_dialect);
var mapping = _configuration.BuildMapping();
var result = new ValidationResult();
try
{
var catalog = PropertiesHelper.GetString("default_catalog", _configuration.Properties, null);
var schema = PropertiesHelper.GetString("default_schema", _configuration.Properties, null);
foreach (var table in mappings.IterateTables)
{
if (!table.IsPhysicalTable || !Configuration.IncludeAction(table.SchemaActions, SchemaAction.Validate))
continue;
var tableMetadata = databaseMetadata.GetTableMetadata(table.Name, table.Schema ?? schema, table.Catalog ?? catalog, table.IsQuoted);
if (tableMetadata == null)
{
result.MissingTables.Add(table);
}
else
{
foreach (var column in table.ColumnIterator)
{
var columnMetadata = tableMetadata.GetColumnMetadata(column.Name);
if (columnMetadata == null)
{
result.AddMissingColumn(table, column);
}
if (!column.GetSqlType(dialect, mapping).ToLower().StartsWith(columnMetadata.TypeName.ToLower()))
{
result.AddInvalidColumn(table, column);
}
}
}
}
}
catch (Exception ex)
{
LogHelper.Error<SchemaChangeValidator>(ex.Message, ex);
result = new ValidationResult(ex);
}
return result;
}