Ejemplo n.º 1
0
 public void InvokeFlowRule(FlowRule rule, CSEntry csentry, MVEntry mventry)
 {
     Tracer.TraceInformation("enter-invokeflowrule {0}", rule.Name);
     Tracer.Indent();
     try
     {
         FlowRule r           = (FlowRule)rule;
         object   targetValue = null;
         foreach (Value value in r.SourceExpression.Source)
         {
             if (value.GetType().Equals(typeof(MultiValueAttribute)))
             {
                 MultiValueAttribute attr = (MultiValueAttribute)value;
                 object mv = attr.GetValueOrDefault(r.Direction, csentry, mventry);
                 targetValue = attr.Transform(mv, TransformDirection.Source);
             }
             if (value.GetType().Equals(typeof(Attribute)))
             {
                 Attribute attr         = (Attribute)value;
                 object    concateValue = attr.GetValueOrDefault(r.Direction, csentry, mventry);
                 concateValue = attr.Transform(concateValue, TransformDirection.Source);
                 targetValue  = targetValue as string + concateValue;
                 attr         = null;
                 continue;
             }
             if (value.GetType().Equals(typeof(Constant)))
             {
                 targetValue = targetValue + ((Constant)value).Value;
                 continue;
             }
         }
         targetValue = r.Target.Transform(targetValue, TransformDirection.Target);
         r.Target.SetTargetValue(r.Direction, csentry, mventry, targetValue);
         r = null;
     }
     catch (Exception ex)
     {
         Tracer.TraceError("invokeflowrule {0}", ex.GetBaseException());
         throw ex;
     }
     finally
     {
         Tracer.Unindent();
         Tracer.TraceInformation("exit-invokeflowrule {0}", rule.Name);
     }
 }
Ejemplo n.º 2
0
 public void InvokeMapJoinRule(JoinRule rule, CSEntry csentry, ref ValueCollection values)
 {
     Tracer.TraceInformation("enter-invokemapjoinrule {0}", rule.Name);
     try
     {
         object targetValue = null;
         foreach (Value value in rule.SourceExpression.Source)
         {
             if (value.GetType().Equals(typeof(MultiValueAttribute)))
             {
                 MultiValueAttribute attr = (MultiValueAttribute)value;
                 object mv = attr.GetValueOrDefault(Direction.Import, csentry, null);
                 targetValue = attr.Transform(mv, TransformDirection.Source);
             }
             if (value.GetType().Equals(typeof(Attribute)))
             {
                 Attribute attr         = (Attribute)value;
                 object    concateValue = attr.GetValueOrDefault(Direction.Import, csentry, null);
                 concateValue = attr.Transform(concateValue, TransformDirection.Source);
                 targetValue  = targetValue as string + concateValue;
                 attr         = null;
                 continue;
             }
             if (value.GetType().Equals(typeof(Constant)))
             {
                 targetValue = targetValue + ((Constant)value).Value;
                 continue;
             }
         }
         Tracer.TraceInformation("add-invokemapjoinrule-value rule: {0}, value: '{1}'", rule.Name, targetValue);
         values.Add(targetValue as string);
     }
     catch (Exception ex)
     {
         Tracer.TraceError("invokemapjoinrule {0}", ex.GetBaseException());
         throw ex;
     }
     finally
     {
         Tracer.TraceInformation("exit-invokemapjoinrule {0}", rule.Name);
     }
 }