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


C# Table.FindColumn方法代码示例

本文整理汇总了C#中Table.FindColumn方法的典型用法代码示例。如果您正苦于以下问题:C# Table.FindColumn方法的具体用法?C# Table.FindColumn怎么用?C# Table.FindColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Table的用法示例。


在下文中一共展示了Table.FindColumn方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: GetCommand

        public ICommandBuilder GetCommand(Table table, params object[] keyValues)
        {
            _commandBuilder.Append(GetSelectClause(table));
            var param = _commandBuilder.AddParameter(keyValues[0], table.FindColumn(table.PrimaryKey[0]));
            _commandBuilder.Append(string.Format(" where {0} = {1}", _schema.QuoteObjectName(table.PrimaryKey[0]), param.Name));
            for (int i = 1; i < table.PrimaryKey.Length; i++)
            {
                param = _commandBuilder.AddParameter(keyValues[i], table.FindColumn(table.PrimaryKey[i]));
                _commandBuilder.Append(string.Format(" and {0} = {1}", _schema.QuoteObjectName(table.PrimaryKey[i]), param.Name));
            }

            return _commandBuilder;
        }
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:13,代码来源:FindHelper.cs

示例3: GetDbDataParameter

 private static IDbDataParameter GetDbDataParameter(Table table, IDbCommand command, KeyValuePair<string, object> kvp)
 {
     return command.Parameters.Cast<IDbDataParameter>().
         FirstOrDefault
         (p =>
          p.SourceColumn ==
          table.FindColumn(kvp.Key).ActualName);
 }
开发者ID:kppullin,项目名称:Simple.Data,代码行数:8,代码来源:BulkUpdater.cs

示例4: CreateWhereInStatement

 private string CreateWhereInStatement(SimpleExpression criteria, Table table)
 {
     var inClauseBuilder = new CommandBuilder(_schema);
     var keyColumn = table.FindColumn(table.PrimaryKey[0]);
     inClauseBuilder.Append(string.Format("SELECT {0} FROM {1}",
                                          keyColumn.QualifiedName, table.QualifiedName));
     inClauseBuilder.Append(" ");
     inClauseBuilder.Append(string.Join(" ",
                                        new Joiner(JoinType.Inner, _schema).GetJoinClauses(
                                            new ObjectName(table.Schema, table.ActualName), criteria)));
     inClauseBuilder.Append(" where ");
     inClauseBuilder.Append(_expressionFormatter.Format(criteria));
     return string.Format("{0} IN ({1})", keyColumn.QualifiedName, inClauseBuilder.Text);
 }
开发者ID:kotsaris,项目名称:Simple.Data,代码行数:14,代码来源:UpdateHelper.cs

示例5: 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

示例6: CreateColumnUpdateClause

 private string CreateColumnUpdateClause(string columnName, object value, Table table)
 {
     var column = table.FindColumn(columnName);
     return string.Format("{0} = {1}", column.QuotedName, _commandBuilder.AddParameter(value, column).Name);
 }
开发者ID:paulecoyote,项目名称:Simple.Data,代码行数:5,代码来源:UpdateHelper.cs

示例7: 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

示例8: CreateColumnUpdateClause

        private string CreateColumnUpdateClause(string columnName, object value, Table table)
        {
            var column = table.FindColumn(columnName);
            var mathReference = value as SimpleReference;
            string rightOperand;
            if (ReferenceEquals(mathReference, null))
            {
                rightOperand = _commandBuilder.AddParameter(value, column).Name;
            }
            else
            {
                rightOperand =
                    new SimpleReferenceFormatter(_schema, _commandBuilder).FormatColumnClauseWithoutAlias(mathReference);
            }


            return string.Format("{0} = {1}", column.QuotedName, rightOperand);
        }
开发者ID:kotsaris,项目名称:Simple.Data,代码行数:18,代码来源:UpdateHelper.cs

示例9: InsertRow

        private static IDictionary<string, object> InsertRow(IDictionary<string, object> row, List<Column> columns, Table table, IDbCommand insertCommand, IDbCommand selectCommand)
        {
            var values = new object[insertCommand.Parameters.Count];
            foreach (var kvp in row)
            {
                int index = columns.IndexOf(table.FindColumn(kvp.Key));
                if (index == -1)
                {
                    values[index] = kvp.Value;
                }
            }

            CommandHelper.SetParameterValues(insertCommand, values);
            if (TryExecute(insertCommand) == 1)
                return TryExecuteSingletonQuery(selectCommand);
            return null;
        }
开发者ID:darrencauthon,项目名称:Simple.Data,代码行数:17,代码来源:BulkInserter.cs


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