Created
November 25, 2011 10:17
-
-
Save Nilzor/1393205 to your computer and use it in GitHub Desktop.
DynamicSalutationRulesActivity - WF4 dynamic activity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Translates a "MyRule" object to a Sequence of If-Then-Assign-Actions | |
/// </summary> | |
public class DynamicSalutationRulesActivity : Activity | |
{ | |
public InArgument<Person> Person { get; set; } | |
public DynamicSalutationRulesActivity(List<SalutationAssignmentRule> rules) | |
{ | |
Common.AddVbSetting(this); | |
var sequence = new Sequence(); | |
this.Implementation = () => sequence; | |
// Sort descending - those added first are lowest priority | |
var sortedRules = rules.OrderByDescending(p => p.Priority).ToList(); | |
// Convert to if-activities and add to sequence | |
foreach (var inRule in sortedRules) | |
{ | |
var outRule = RuleConverter.ToIfActivity(inRule); | |
sequence.Activities.Add(outRule); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment