-
-
Notifications
You must be signed in to change notification settings - Fork 383
Expand file tree
/
Copy pathFieldCalculationMapOptions.cs
More file actions
61 lines (54 loc) · 2.25 KB
/
Copy pathFieldCalculationMapOptions.cs
File metadata and controls
61 lines (54 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Collections.Generic;
using MigrationTools.Tools.Infrastructure;
namespace MigrationTools.Tools {
public enum FieldCalculationMapParsingFallback {
RaiseError,
ResetToZero
}
/// <summary>
/// Performs mathematical calculations on numeric fields using NCalc expressions during migration.
/// </summary>
/// <status>ready</status>
/// <processingtarget>Work Item Field</processingtarget>
public class FieldCalculationMapOptions : FieldMapOptions {
/// <summary>
/// Gets or sets the NCalc expression to evaluate. Variables in the expression should be enclosed in square brackets (e.g., "[x]*2").
/// </summary>
/// <default>null</default>
public string expression { get; set; }
/// <summary>
/// Gets or sets the parsing fallback.
/// </summary>
/// <default>null</default>
public FieldCalculationMapParsingFallback parsingFallback { get; set; } =
FieldCalculationMapParsingFallback.RaiseError;
/// <summary>
/// Gets or sets a dictionary mapping variable names used in the expression to source field reference names.
/// </summary>
/// <default>{}</default>
public Dictionary<string, string> parameters { get; set; }
/// <summary>
/// Gets or sets the target field reference name where the calculated result will be stored.
/// </summary>
/// <default>null</default>
public string targetField { get; set; }
/// <summary>
/// Sets example configuration defaults for documentation purposes.
/// </summary>
public void SetExampleConfigDefaults() {
ApplyTo = new List<string>() { "SomeWorkItemType" };
expression = "[x]*2";
parameters = new Dictionary<string, string> {
{ "x", "Custom.FieldB" }
};
targetField = "Custom.FieldC";
parsingFallback = FieldCalculationMapParsingFallback.RaiseError;
}
/// <summary>
/// Initializes a new instance of the FieldCalculationMapOptions class.
/// </summary>
public FieldCalculationMapOptions() {
parameters = new Dictionary<string, string>();
}
}
}