本文整理汇总了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];
}
}
示例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;
}
示例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;
}
示例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;
//.........这里部分代码省略.........
示例5: ThereIsAKeyMatch
private static bool ThereIsAKeyMatch(Row leftRow, string firstKey) {
return leftRow.ContainsKey(firstKey);
}
示例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 != "-";
}