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


C# IParameters.ContainsName方法代码示例

本文整理汇总了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";
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:31,代码来源:MailOperation.cs

示例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);
                            }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:67,代码来源:TransformOperationFactory.cs


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