/// <summary> /// Creates a new TransformationRuleSource instance for the given transformation rule in the given context /// </summary> /// <param name="rule">The transformation rule that should be used as source</param> /// <param name="context">The context in which the computations should be used by the current instance</param> public InPlaceTransformationRuleSource(InPlaceTransformationRuleBase <TIn> rule, ITransformationContext context) { if (rule == null) { throw new ArgumentNullException("rule"); } if (context == null) { throw new ArgumentNullException("context"); } TransformationRule = rule; Context = context; rule.Dependencies.Add(this); foreach (var c in context.Trace.TraceAllIn(rule).OfType <Computation>()) { items.Add(new InPlaceComputationWrapper <TIn>(c)); } }
/// <summary> /// Creates a new computation source from a transformation rule /// </summary> /// <typeparam name="TInput1">The type of the first input arguments for the transformation rule</typeparam> /// <typeparam name="TInput2">The type of the second input arguments for the transformation rule</typeparam> /// <param name="rule">The rule that should be taken as a source of computation objects</param> /// <param name="allowNull">A boolean value indicating whether null values should be allowed</param> /// <param name="filter">A method or lambda expression to filter the computation objects</param> /// <returns>A source of computations that can further be dealt with</returns> public static Func <ITransformationContext, INotifyEnumerable <InPlaceComputationWrapper <TInput1, TInput2> > > ToComputationSource <TInput1, TInput2>(this InPlaceTransformationRuleBase <TInput1, TInput2> rule, bool allowNull, Func <InPlaceComputationWrapper <TInput1, TInput2>, bool> filter) where TInput1 : class where TInput2 : class { if (rule == null) { throw new ArgumentNullException("rule"); } return(context => rule.ToComputationSource(context, allowNull, filter)); }
/// <summary> /// Creates a new computation source from a transformation rule /// </summary> /// <typeparam name="TInput">The type of the input arguments for the transformation rule</typeparam> /// <param name="rule">The rule that should be taken as a source of computation objects</param> /// <returns>A source of computations that can further be dealt with</returns> public static Func <ITransformationContext, INotifyEnumerable <InPlaceComputationWrapper <TInput> > > ToComputationSource <TInput>(this InPlaceTransformationRuleBase <TInput> rule) where TInput : class { if (rule == null) { throw new ArgumentNullException("rule"); } return(context => rule.ToComputationSource(context)); }
public static INotifyEnumerable <InPlaceComputationWrapper <TInput1, TInput2> > ToComputationSource <TInput1, TInput2>(this InPlaceTransformationRuleBase <TInput1, TInput2> rule, ITransformationContext context, bool allowNull, Func <InPlaceComputationWrapper <TInput1, TInput2>, bool> filter) where TInput1 : class where TInput2 : class { if (rule == null) { throw new ArgumentNullException("rule"); } var trs = new InPlaceTransformationRuleSource <TInput1, TInput2>(rule, context) { Filter = filter }; if (allowNull) { trs.AddNullItem(); } return(trs); }
/// <summary> /// Creates a new computation source from a transformation rule /// </summary> /// <typeparam name="TInput1">The type of the first input arguments for the transformation rule</typeparam> /// <typeparam name="TInput2">The type of the second input arguments for the transformation rule</typeparam> /// <param name="rule">The rule that should be taken as a source of computation objects</param> /// <param name="context">The context in which the rule is used as source of computations</param> /// <returns>A source of computations that can further be dealt with</returns> public static INotifyEnumerable <InPlaceComputationWrapper <TInput1, TInput2> > ToComputationSource <TInput1, TInput2>(this InPlaceTransformationRuleBase <TInput1, TInput2> rule, ITransformationContext context) where TInput1 : class where TInput2 : class { if (rule == null) { throw new ArgumentNullException("rule"); } return(new InPlaceTransformationRuleSource <TInput1, TInput2>(rule, context)); }
public static INotifyEnumerable <InPlaceComputationWrapper <TInput> > ToComputationSource <TInput>(this InPlaceTransformationRuleBase <TInput> rule, ITransformationContext context, Func <InPlaceComputationWrapper <TInput>, bool> filter) where TInput : class { if (rule == null) { throw new ArgumentNullException("rule"); } return(new InPlaceTransformationRuleSource <TInput>(rule, context) { Filter = filter }); }