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


C# Fields.FindByParamater方法代码示例

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


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

示例1: Read

        public IParameters Read(TflTransform transform) {
            var parameters = new Parameters.Parameters(_defaultFactory);
            var fields = new Fields(_process.OutputFields(), _process.CalculatedFields.WithoutOutput());

            foreach (var p in transform.Parameters) {

                if (!string.IsNullOrEmpty(p.Field)) {
                    if (fields.FindByParamater(p).Any()) {
                        var field = fields.FindByParamater(p).Last();
                        var name = string.IsNullOrEmpty(p.Name) ? field.Alias : p.Name;
                        parameters.Add(field.Alias, name, null, field.Type);
                    } else {
                        _process.Logger.Warn("A {0} transform references {1}, but I can't find the definition for {1}.\r\nYou may need to define the entity attribute in the parameter element.\r\nOr, set the output attribute to true in the field element. Process transforms rely on fields being output.\r\nOne other possibility is that the participates in a relationship with another field with the same name and Transformalize doesn't know which one you want.  If that's the case, you have to alias one of them.", transform.Method, p.Field);
                        var name = p.Name.Equals(string.Empty) ? p.Field : p.Name;
                        parameters.Add(p.Field, name, p.HasValue() ? p.Value : null, p.Type);
                    }
                } else {
                    var parameter = new Parameter(p.Name, p.Value) {
                        SimpleType = Common.ToSimpleType(p.Type),
                        ValueReferencesField = p.HasValue() && fields.Find(p.Value).Any()
                    };
                    parameters.Add(p.Name, parameter);
                }
            }

            return parameters;
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:27,代码来源:ProcessTransformParametersReader.cs

示例2: Read

        public IParameters Read(TflTransform transform) {
            var parameters = new Parameters.Parameters(new DefaultFactory(_logger));

            foreach (var p in transform.Parameters) {
                if (string.IsNullOrEmpty(p.Field) && (string.IsNullOrEmpty(p.Name) || string.IsNullOrEmpty(p.Value))) {
                    throw new TransformalizeException(_logger, "The entity {0} has a {1} transform parameter without a field attribute, or name and value attributes.  Entity parameters require one or the other.", _entity.Alias, transform.Method);
                }

                var fields = new Fields(_entity.Fields, _entity.CalculatedFields);
                if (!string.IsNullOrEmpty(p.Field)) {
                    if (fields.FindByParamater(p).Any()) {
                        var field = fields.FindByParamater(p).Last();
                        var name = string.IsNullOrEmpty(p.Name) ? field.Alias : p.Name;
                        parameters.Add(field.Alias, name, null, field.Type);
                    } else {
                        if (!p.Field.StartsWith("Tfl")) {
                            _logger.EntityWarn(_entity.Name, "The entity {0} has a {1} transform parameter that references field {2}.  This field hasn't been defined yet in {0}.", _entity.Alias, transform.Method, p.Field);
                        }
                        var name = string.IsNullOrEmpty(p.Name) ? p.Field : p.Name;
                        parameters.Add(p.Field, name, p.HasValue() ? p.Value : null, "System.String");
                    }
                } else {
                    var parameter = new Parameter(p.Name, p.Value) {
                        SimpleType = Common.ToSimpleType(p.Type),
                        ValueReferencesField = p.HasValue() && fields.Find(p.Value).Any()
                    };
                    parameters.Add(p.Name, parameter);
                }
            }

            return parameters;
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:32,代码来源:EntityTransformParametersReader.cs


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