本文整理汇总了C#中IParameters.ContainsName方法的典型用法代码示例。如果您正苦于以下问题:C# IParameters.ContainsName方法的具体用法?C# IParameters.ContainsName怎么用?C# IParameters.ContainsName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParameters
的用法示例。
在下文中一共展示了IParameters.ContainsName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MailOperation
public MailOperation(MailConnection connection, IParameters parameters)
: base(string.Empty, string.Empty) {
_connection = connection;
_parameters = parameters;
_hasCc = parameters.ContainsName("cc");
_ccKey = _hasCc ? parameters.GetKeyByName("cc") : string.Empty;
_hasBcc = parameters.ContainsName("bcc");
_bccKey = _hasBcc ? parameters.GetKeyByName("bcc") : string.Empty;
_hasSubject = parameters.ContainsName("subject");
_subjectKey = _hasSubject ? parameters.GetKeyByName("subject") : string.Empty;
if (!parameters.ContainsName("from")) {
throw new TransformalizeException(Logger, EntityName, "Mail transform requires parameter named from.");
}
_fromKey = parameters.GetKeyByName("from");
if (!parameters.ContainsName("to")) {
throw new TransformalizeException(Logger, EntityName, "Mail transform requires parameter named to.");
}
_toKey = parameters.GetKeyByName("to");
if (!parameters.ContainsName("body")) {
throw new TransformalizeException(Logger, EntityName, "Mail transform requires parameter named body.");
}
_bodyKey = parameters.GetKeyByName("body");
Name = "Mail";
}
示例2: Create
//.........这里部分代码省略.........
case "substring":
return new SubstringOperation(
inKey,
outKey,
element.StartIndex,
element.Length
) { ShouldRun = shouldRun, EntityName = _entityName };
case "left":
return new LeftOperation(
inKey,
outKey,
element.Length
) { ShouldRun = shouldRun, EntityName = _entityName };
case "right":
return new RightOperation(
inKey,
outKey,
element.Length
) { ShouldRun = shouldRun, EntityName = _entityName };
case "hashcode":
case "gethashcode":
return new GetHashCodeOperation(
inKey,
outKey
) { ShouldRun = shouldRun, EntityName = _entityName };
case "mail":
var connection = _process.Connections.GetConnectionByName(element.Connection).Connection;
if (!parameters.ContainsName("body")) {
parameters.Add(field.Alias, "body", null, "string");
}
return new MailOperation(
(MailConnection)connection,
parameters
) { ShouldRun = shouldRun, EntityName = _entityName };
case "map":
var equals = _process.MapEquals.ContainsKey(element.Map) ? _process.MapEquals[element.Map] : new Map();
var startsWith = _process.MapStartsWith.ContainsKey(element.Map) ? _process.MapStartsWith[element.Map] : new Map();
var endsWith = _process.MapEndsWith.ContainsKey(element.Map) ? _process.MapEndsWith[element.Map] : new Map();
//TODO: Move to Modify and Validate
if (equals.Count == 0 && startsWith.Count == 0 && endsWith.Count == 0) {
if (element.Map.Contains("=")) {
foreach (var item in element.Map.Split(new[] { ',' })) {
var split = item.Split(new[] { '=' });
if (split.Length == 2) {
var left = split[0];
var right = split[1];
Field tryField;
if (_process.TryGetField(_entityName, right, out tryField, false)) {
equals.Add(left, new Item(tryField.Alias, right));
} else {
equals.Add(left, new Item(right));
}
}
}
if (equals.Count == 0) {
_logger.EntityWarn(_entityName, "Map '{0}' is empty.", element.Map);
}