当前位置: 首页>>代码示例>>C#>>正文


C# Table.HasColumn方法代码示例

本文整理汇总了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);

        } 
开发者ID:andy01pr,项目名称:Simple.Data.Mysql,代码行数:12,代码来源:MysqlCustomInserter.cs

示例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;
 }
开发者ID:crmmvio,项目名称:Simple.Data,代码行数:24,代码来源:SqlCustomInserter.cs

示例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));
            }
        }
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:9,代码来源:AdoAdapterInserter.cs

示例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.");
            }
        }
开发者ID:ChrisMH,项目名称:Simple.Data,代码行数:9,代码来源:AdoAdapterInserter.cs

示例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);
 }
开发者ID:kotsaris,项目名称:Simple.Data,代码行数:7,代码来源:UpdateHelper.cs


注:本文中的Table.HasColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。