示例#1
0
        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);
        }
 public ParametersExtract(Process process) : base(process.OutputConnection) {
     _process = process;
     UseTransaction = false;
     _keys = new HashSet<string>(_process.Parameters.ToEnumerable().Where(p => !p.Value.HasValue()).Select(p => p.Key));
     _keys.IntersectWith(process.OutputFields().Select(f=>f.Alias));
 }