本文整理汇总了C#中Table.HasColumn方法的典型用法代码示例。如果您正苦于以下问题:C# Table.HasColumn方法的具体用法?C# Table.HasColumn怎么用?C# Table.HasColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.HasColumn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildDataDictionary
private static Dictionary<Column, object> BuildDataDictionary(AdoAdapter adapter,
IDictionary<string, object> data, Table table)
{
Func<string, bool> columnFilter = key =>
table.HasColumn(key) &&
(table.FindColumn(key).IsWriteable ||
((adapter.AdoOptions != null && adapter.AdoOptions.IdentityInsert) && table.FindColumn(key).IsIdentity));
return data.Where(kvp => columnFilter(kvp.Key))
.ToDictionary(kvp => table.FindColumn(kvp.Key), kvp => kvp.Value);
}
示例2: BuildDataDictionary
private static Dictionary<Column, object> BuildDataDictionary(AdoAdapter adapter, IDictionary<string, object> data, Table table)
{
Func<string, bool> columnFilter;
if (adapter.AdoOptions != null && adapter.AdoOptions.IdentityInsert)
{
columnFilter =
key =>
{
Column column;
if (table.TryFindColumn(key, out column))
{
return column.IsWriteable || column.IsIdentity;
}
return false;
};
}
else
{
columnFilter = key => table.HasColumn(key) && table.FindColumn(key).IsWriteable;
}
var dataDictionary = data.Where(kvp => columnFilter(kvp.Key))
.ToDictionary(kvp => table.FindColumn(kvp.Key), kvp => kvp.Value);
return dataDictionary;
}
示例3: CheckInsertablePropertiesAreAvailable
private void CheckInsertablePropertiesAreAvailable(Table table, IEnumerable<KeyValuePair<string, object>> data)
{
data = data.Where(kvp => table.HasColumn(kvp.Key));
if (!data.Any())
{
throw new SimpleDataException(string.Format("No properties were found which could be mapped to table '{0}'.", table.ActualName));
}
}
示例4: CheckInsertablePropertiesAreAvailable
private void CheckInsertablePropertiesAreAvailable(Table table, IEnumerable<KeyValuePair<string, object>> data)
{
data = data.Where(kvp => table.HasColumn(kvp.Key));
if (data.Count() == 0)
{
throw new SimpleDataException("No properties were found which could be mapped to the database.");
}
}
示例5: GetUpdateClause
private string GetUpdateClause(Table table, IEnumerable<KeyValuePair<string, object>> data)
{
var setClause = string.Join(", ",
data.Where(kvp => table.HasColumn(kvp.Key) && table.FindColumn(kvp.Key).IsWriteable)
.Select(kvp => CreateColumnUpdateClause(kvp.Key, kvp.Value, table)));
return string.Format("update {0} set {1}", table.QualifiedName, setClause);
}