本文整理汇总了C#中Fields.WithString方法的典型用法代码示例。如果您正苦于以下问题:C# Fields.WithString方法的具体用法?C# Fields.WithString怎么用?C# Fields.WithString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fields
的用法示例。
在下文中一共展示了Fields.WithString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TruncateOperation
public TruncateOperation(string entityName, Fields fields, Fields calculatedFields = null)
: base(string.Empty, string.Empty) {
EntityName = entityName;
foreach (Field field in fields.WithString()) {
_aliases.Add(field.Alias);
var value = field.Length.Equals("max", IC) ? Int32.MaxValue.ToString(CultureInfo.InvariantCulture) : field.Length;
if (CanChangeType(value, typeof(int))) {
_lengthMap[field.Alias] = Convert.ToInt32(value);
} else {
throw new TransformalizeException(Logger, "Can not change field {0}'s length of '{0}' to an integer. Please use an integer or the keyword: max.", field.Alias, value);
}
}
if (calculatedFields != null) {
foreach (var field in calculatedFields.WithString()) {
if (!_aliases.Contains(field.Alias)) {
_aliases.Add(field.Alias);
var value = field.Length.Equals("max", IC) ? Int32.MaxValue.ToString(CultureInfo.InvariantCulture) : field.Length;
if (CanChangeType(value, typeof(int))) {
_lengthMap[field.Alias] = Convert.ToInt32(value);
} else {
throw new TransformalizeException(Logger, "Can not change field {0}'s length of '{1}' to an integer. Please use an integer or the keyword: max.", field.Alias, value);
}
}
}
}
base.OnFinishedProcessing += StringLengthOperation_OnFinishedProcessing;
}