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


C# Row.ContainsKey方法代码示例

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


在下文中一共展示了Row.ContainsKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Accumulate

        protected override void Accumulate(Row row, Row aggregate) {
            if (aggregate.ContainsKey(_firstKey)) return;

            foreach (var key in _keys) {
                aggregate[key] = row[key];
            }
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:EntityKeysDistinct.cs

示例2: AssertDefined

        protected bool AssertDefined(Row row, string column, Errors errors)
        {
            if(Ignore.Column(row, column))
            {
                return false;
            }

            if (AssertTrue(row, row.ContainsKey(column), "Column undefined: " + column, errors))
            {
                return AssertTrue(row, Defined(row, column, errors), "Value undefined for " + column + " (" + row[column] + ")", errors);
            }
            return false;
        }
开发者ID:jperdue,项目名称:cde-export,代码行数:13,代码来源:BaseTest.cs

示例3: MergeRows

        protected override Row MergeRows(Row leftRow, Row rightRow) {

            if (rightRow.ContainsKey(_firstKey)) {
                var wasDeleted = _entityDelete && rightRow["TflDeleted"] != null && (bool)rightRow["TflDeleted"];
                if (wasDeleted || !_hasVersion || UpdateIsNecessary(ref leftRow, ref rightRow, _versionAlias, _versionSimpleType)) {
                    leftRow["TflAction"] = EntityAction.Update;
                    leftRow["TflKey"] = rightRow["TflKey"];
                    leftRow["TflBatchId"] = _tflBatchId;
                    leftRow["TflDeleted"] = false;
                } else {
                    leftRow["TflAction"] = EntityAction.None;
                    leftRow["TflDeleted"] = false;
                }
            } else {
                leftRow["TflAction"] = EntityAction.Insert;
                leftRow["TflBatchId"] = _tflBatchId;
                leftRow["TflDeleted"] = false;
            }

            return leftRow;
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:21,代码来源:EntityJoinAction.cs

示例4: Accumulate

        protected override void Accumulate(Row row, Row aggregate) {
            //init
            if (!aggregate.ContainsKey(_firstKey)) {
                foreach (var alias in _keysToGroupBy) {
                    aggregate[alias] = row[alias];
                }

                foreach (var field in _fieldsToAccumulate) {
                    if (_needZero.ContainsKey(field.Aggregate)) {
                        aggregate[field.Alias] = 0;
                    } else {
                        if (field.Aggregate.Equals("minlength")) {
                            aggregate[field.Alias] = row[field.Alias].ToString().Length;
                        } else {
                            aggregate[field.Alias] = row[field.Alias];
                        }
                    }
                }
            }

            //accumulate
            foreach (var field in _fieldsToAccumulate) {
                int len;
                switch (field.Aggregate) {
                    case "count":
                        if (field.Distinct) {
                            var key = row.CreateKey(_keysToGroupBy);
                            var value = row[field.Name];
                            if (!_distinct[field.Alias].ContainsKey(key)) {
                                _distinct[field.Alias].Add(key, new Dictionary<object, byte>());
                            }
                            if (!_distinct[field.Alias][key].ContainsKey(value)) {
                                _distinct[field.Alias][key].Add(value, 0);
                                aggregate[field.Alias] = (int)aggregate[field.Alias] + 1;
                            }
                            break;
                        }
                        aggregate[field.Alias] = (int)aggregate[field.Alias] + 1;
                        break;
                    case "sum":
                        aggregate[field.Alias] = (dynamic)aggregate[field.Alias] + (dynamic)row[field.Alias];
                        break;
                    case "max":
                        switch (field.SimpleType) {
                            case "byte[]":
                                aggregate[field.Alias] = Max((byte[])aggregate[field.Alias], (byte[])row[field.Alias]);
                                break;
                            default:
                                var comparable = aggregate[field.Alias] as IComparable;
                                if (comparable != null) {
                                    if (comparable.CompareTo(row[field.Alias]) < 0) {
                                        aggregate[field.Alias] = row[field.Alias];
                                    }
                                }
                                break;
                        }
                        break;
                    case "min":
                        switch (field.SimpleType) {
                            case "byte[]":
                                aggregate[field.Alias] = Min((byte[])aggregate[field.Alias], (byte[])row[field.Alias]);
                                break;
                            default:
                                var comparable = aggregate[field.Alias] as IComparable;
                                if (comparable != null) {
                                    if (comparable.CompareTo(row[field.Alias]) > 0) {
                                        aggregate[field.Alias] = row[field.Alias];
                                    }
                                }
                                break;
                        }
                        break;

                    case "maxlength":
                        len = row[field.Alias].ToString().Length;
                        if (len > (dynamic)aggregate[field.Alias]) {
                            aggregate[field.Alias] = len;
                        }
                        break;

                    case "minlength":
                        len = row[field.Alias].ToString().Length;
                        if (len < (dynamic)aggregate[field.Alias]) {
                            aggregate[field.Alias] = len;
                        }
                        break;

                    case "first":
                        if (aggregate[field.Alias] == null) {
                            aggregate[field.Alias] = row[field.Alias];
                        }
                        break;

                    case "last":
                        aggregate[field.Alias] = row[field.Alias];
                        break;

                    case "join":
                        Keep(field.Alias, row);
                        break;
//.........这里部分代码省略.........
开发者ID:modulexcite,项目名称:Transformalize,代码行数:101,代码来源:EntityAggregation.cs

示例5: ThereIsAKeyMatch

 private static bool ThereIsAKeyMatch(Row leftRow, string firstKey) {
     return leftRow.ContainsKey(firstKey);
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:3,代码来源:EntityDetectDeletes.cs

示例6: Defined

        protected bool Defined(Row row, string column, Errors errors)
        {
            if(!row.ContainsKey(column))
            {
                errors.Add(row, "Column not defined: " + column, GetPrettyName());
                return false;
            }

            var value = row[column].Trim();

            return !String.IsNullOrEmpty(value) && value != "-";
        }
开发者ID:jperdue,项目名称:cde-export,代码行数:12,代码来源:BaseTest.cs


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