Skip to content

Commit e925fb3

Browse files
authored
Merge pull request #20 from data-solution-automation-engine/dev-may-updates
Dev may updates
2 parents bbca184 + b9f9913 commit e925fb3

35 files changed

+513
-199
lines changed

ClassLibrary/DataWarehouseAutomation/DataWarehouseAutomation.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample Metadata", "Sample M
2121
Sample_Metadata\sampleBasic.json = Sample_Metadata\sampleBasic.json
2222
Sample_Metadata\sampleBasicWithExtensions.json = Sample_Metadata\sampleBasicWithExtensions.json
2323
Sample_Metadata\sampleCalculation.json = Sample_Metadata\sampleCalculation.json
24-
Sample_Metadata\sampleCustomFunctions.json = Sample_Metadata\sampleCustomFunctions.json
2524
Sample_Metadata\sampleFreeForm.json = Sample_Metadata\sampleFreeForm.json
2625
Sample_Metadata\sampleJsonStagingWithPsaDetails.json = Sample_Metadata\sampleJsonStagingWithPsaDetails.json
2726
Sample_Metadata\sampleMultipleDataItemMappings.json = Sample_Metadata\sampleMultipleDataItemMappings.json
@@ -47,6 +46,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample Templates", "Sample
4746
Sample_Templates\TemplateSampleFreeForm.Handlebars = Sample_Templates\TemplateSampleFreeForm.Handlebars
4847
Sample_Templates\TemplateSampleMultipleDataItemMappings.Handlebars = Sample_Templates\TemplateSampleMultipleDataItemMappings.Handlebars
4948
Sample_Templates\TemplateSampleSimpleDDL.Handlebars = Sample_Templates\TemplateSampleSimpleDDL.Handlebars
49+
Sample_Templates\TemplateSampleSourceQuery.Handlebars = Sample_Templates\TemplateSampleSourceQuery.Handlebars
5050
Sample_Templates\TemplateSatelliteView.Handlebars = Sample_Templates\TemplateSatelliteView.Handlebars
5151
EndProjectSection
5252
EndProject
Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System.Collections.Generic;
2-
using Newtonsoft.Json;
2+
using System.Text.Json.Serialization;
33

44
namespace DataWarehouseAutomation;
55

@@ -9,29 +9,39 @@ namespace DataWarehouseAutomation;
99
/// </summary>
1010
public class BusinessKeyDefinition
1111
{
12+
#nullable enable
13+
14+
/// <summary>
15+
/// Optional identifier as a string value to allow various identifier approaches.
16+
/// </summary>
17+
[JsonPropertyName("id")]
18+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
19+
public string Id { get; set; } = string.Empty;
20+
1221
/// <summary>
1322
/// Items that define the Business Key e.g. the collection of columns for a Business Key.
1423
/// </summary>
15-
[JsonProperty("businessKeyComponentMapping")]
24+
[JsonPropertyName("businessKeyComponentMapping")]
1625
public List<DataItemMapping> BusinessKeyComponentMapping { get; set; } = new();
1726

18-
#nullable enable
19-
2027
/// <summary>
2128
/// An optional label for the end result e.g. the target business key attribute.
2229
/// </summary>
23-
[JsonProperty("surrogateKey", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
30+
[JsonPropertyName("surrogateKey")]
31+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
2432
public string? SurrogateKey { get; set; }
2533

2634
/// <summary>
2735
/// Free-form and optional classification for the Business Key for use in generation logic (evaluation).
2836
/// </summary>
29-
[JsonProperty("businessKeyClassification", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
37+
[JsonPropertyName("businessKeyClassification")]
38+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
3039
public List<DataClassification>? BusinessKeyClassification { get; set; }
3140

3241
/// <summary>
3342
/// The collection of extension Key/Value pairs.
3443
/// </summary>
35-
[JsonProperty("extensions", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
44+
[JsonPropertyName("extensions")]
45+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
3646
public List<Extension>? Extensions { get; set; }
3747
}
Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,61 @@
1-
using Newtonsoft.Json;
1+
using System.Text.Json.Serialization;
22

33
namespace DataWarehouseAutomation;
44

55
/// <summary>
6-
/// A free form list of classifications (labels) and notes to add to a data object mapping.
6+
/// Used to define a list of classifications (labels) and notes to add to a data object mapping.
77
/// A classification can be used to identify a certain type of data object mapping.
88
/// </summary>
99
public class DataClassification
1010
{
11-
#nullable enable
11+
#nullable enable
1212

1313
/// <summary>
14-
/// Optional identifier for the classification.
14+
/// Optional identifier as a string value to allow various identifier approaches.
1515
/// </summary>
16-
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
17-
public int? Id { get; set; }
16+
[JsonPropertyName("id")]
17+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
18+
public string Id { get; set; } = string.Empty;
1819

1920
/// <summary>
20-
/// Type mandatory description, usually a keyword used for automation purposes.
21+
/// The mandatory classification description, usually a keyword used for automation purposes.
2122
/// </summary>
22-
[JsonProperty("classification")]
23+
[JsonPropertyName("classification")]
2324
public string Classification { get; set; } = "NewClassification";
2425

2526
/// <summary>
2627
/// Free-format notes on the classification.
2728
/// </summary>
28-
[JsonProperty("notes", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
29+
[JsonPropertyName("notes")]
30+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
2931
public string? Notes { get; set; }
30-
}
32+
33+
#region Methods
34+
/// <summary>
35+
/// Use this method to assert an object as a DataClassification (or not).
36+
/// </summary>
37+
/// <param name="o"></param>
38+
/// <returns></returns>
39+
public override bool Equals(object? o)
40+
{
41+
var other = o as DataClassification;
42+
return other?.Id == Id;
43+
}
44+
45+
/// <summary>
46+
/// Override to get a hash value that represents the identifier.
47+
/// </summary>
48+
/// <returns></returns>
49+
public override int GetHashCode() => Id.GetHashCode();
50+
51+
/// <summary>
52+
/// String override so that the object returns the classification value ('classification').
53+
/// When an instance of this class is passed to a method that expects a string, the ToString() method will be called implicitly to convert the object to a string, and the value of the "Classification" property will be returned.
54+
/// </summary>
55+
/// <returns></returns>
56+
public override string ToString()
57+
{
58+
return Classification;
59+
}
60+
#endregion
61+
}
Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System.Collections.Generic;
2-
using Newtonsoft.Json;
2+
using System.Text.Json.Serialization;
33

44
namespace DataWarehouseAutomation;
55

@@ -8,17 +8,54 @@ namespace DataWarehouseAutomation;
88
/// </summary>
99
public class DataConnection
1010
{
11-
#nullable enable
11+
#nullable enable
12+
13+
/// <summary>
14+
/// Optional identifier as a string value to allow various identifier approaches.
15+
/// </summary>
16+
[JsonPropertyName("id")]
17+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
18+
public string Id { get; set; } = string.Empty;
1219

1320
/// <summary>
1421
/// The connection information expressed in a key, token or (connection)string.
1522
/// </summary>
16-
[JsonProperty("dataConnectionString")]
23+
[JsonPropertyName("dataConnectionString")]
1724
public string DataConnectionString { get; set; } = "NewConnection";
1825

1926
/// <summary>
2027
/// The collection of extension Key/Value pairs.
2128
/// </summary>
22-
[JsonProperty("extensions", NullValueHandling = NullValueHandling.Ignore)]
29+
[JsonPropertyName("extensions")]
30+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
2331
public List<Extension>? Extensions { get; set; }
32+
33+
#region Methods
34+
/// <summary>
35+
/// Use this method to assert an object as a DataConnection (or not).
36+
/// </summary>
37+
/// <param name="o"></param>
38+
/// <returns></returns>
39+
public override bool Equals(object? o)
40+
{
41+
var other = o as DataConnection;
42+
return other?.Id == Id;
43+
}
44+
45+
/// <summary>
46+
/// Override to get a hash value that represents the identifier.
47+
/// </summary>
48+
/// <returns></returns>
49+
public override int GetHashCode() => Id.GetHashCode();
50+
51+
/// <summary>
52+
/// String override so that the object returns its value ('connection string').
53+
/// When an instance of this class is passed to a method that expects a string, the ToString() method will be called implicitly to convert the object to a string, and the value of the "Connection String" property will be returned.
54+
/// </summary>
55+
/// <returns></returns>
56+
public override string ToString()
57+
{
58+
return DataConnectionString;
59+
}
60+
#endregion
2461
}
Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,98 @@
1-
using Newtonsoft.Json;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
2+
using System.Text.Json.Serialization;
33

44
namespace DataWarehouseAutomation;
55

6+
67
public class DataItem
78
{
8-
#nullable enable
9+
#nullable enable
10+
11+
/// <summary>
12+
/// Optional identifier as a string value to allow various identifier approaches.
13+
/// </summary>
14+
[JsonPropertyName("id")]
15+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
16+
public string Id { get; set; } = string.Empty;
917

10-
[JsonProperty("name")]
18+
[JsonPropertyName("name")]
1119
public string Name { get; set; } = "NewDataItemName"; // Mandatory
1220

1321
/// <summary>
1422
/// The data object to which the data item belongs. This can be used to construct fully qualified names.
1523
/// </summary>
16-
[JsonProperty("dataObject", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
24+
[JsonPropertyName("dataObject")]
25+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
1726
public DataObject? DataObject { get; set; }
1827

19-
[JsonProperty("dataType", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
28+
[JsonPropertyName("dataType")]
29+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
2030
public string? DataType { get; set; }
2131

22-
[JsonProperty("characterLength", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
32+
[JsonPropertyName("characterLength")]
33+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
2334
public int? CharacterLength { get; set; }
2435

25-
[JsonProperty("numericPrecision", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
36+
[JsonPropertyName("numericPrecision")]
37+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
2638
public int? NumericPrecision { get; set; }
2739

28-
[JsonProperty("numericScale", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
40+
[JsonPropertyName("numericScale")]
41+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
2942
public int? NumericScale { get; set; }
3043

31-
[JsonProperty("ordinalPosition", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
44+
[JsonPropertyName("ordinalPosition")]
45+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
3246
public int? OrdinalPosition { get; set; }
3347

34-
[JsonProperty("isPrimaryKey", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
48+
[JsonPropertyName("isPrimaryKey")]
49+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
3550
public bool? IsPrimaryKey { get; set; }
3651

37-
[JsonProperty("isHardCodedValue", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
52+
[JsonPropertyName("isHardCodedValue")]
53+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
3854
public bool? IsHardCodedValue { get; set; }
3955

4056
/// <summary>
4157
/// Free-form and optional classification for the Data Item for use in generation logic (evaluation).
4258
/// </summary>
43-
[JsonProperty("dataItemClassification", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
59+
[JsonPropertyName("dataItemClassification")]
60+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
4461
public List<DataClassification>? DataItemClassification { get; set; }
4562

4663
/// <summary>
4764
/// The collection of extension Key/Value pairs.
4865
/// </summary>
49-
[JsonProperty("extensions", NullValueHandling = NullValueHandling.Ignore)]
66+
[JsonPropertyName("extensions")]
67+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
5068
public List<Extension>? Extensions { get; set; }
69+
70+
#region Methods
71+
/// <summary>
72+
/// Use this method to assert an object as a DataItem (or not).
73+
/// </summary>
74+
/// <param name="o"></param>
75+
/// <returns></returns>
76+
public override bool Equals(object? o)
77+
{
78+
var other = o as DataItem;
79+
return other?.Id == Id;
80+
}
81+
82+
/// <summary>
83+
/// Override to get a hash value that represents the identifier.
84+
/// </summary>
85+
/// <returns></returns>
86+
public override int GetHashCode() => Id.GetHashCode();
87+
88+
/// <summary>
89+
/// String override so that the object returns its value ('name').
90+
/// When an instance of this class is passed to a method that expects a string, the ToString() method will be called implicitly to convert the object to a string, and the value of the "Name" property will be returned.
91+
/// </summary>
92+
/// <returns></returns>
93+
public override string ToString()
94+
{
95+
return Name;
96+
}
97+
#endregion
5198
}
Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
2-
using Newtonsoft.Json;
2+
using System.Text.Json.Serialization;
3+
using System.Xml.Linq;
34

45
namespace DataWarehouseAutomation;
56

@@ -8,18 +9,54 @@ namespace DataWarehouseAutomation;
89
/// </summary>
910
public class DataItemMapping
1011
{
11-
#nullable enable
12+
#nullable enable
1213

13-
[JsonProperty("sourceDataItems")]
14+
/// <summary>
15+
/// Optional identifier as a string value to allow various identifier approaches.
16+
/// </summary>
17+
[JsonPropertyName("id")]
18+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
19+
public string Id { get; set; } = string.Empty;
20+
21+
[JsonPropertyName("sourceDataItems")]
1422
public List<dynamic> SourceDataItems { get; set; } = new();
1523

16-
[JsonProperty("targetDataItem")]
24+
[JsonPropertyName("targetDataItem")]
1725
public DataItem TargetDataItem { get; set; } = new() { Name = "NewTargetDataItem" };
1826

1927
/// <summary>
2028
/// The collection of extension Key/Value pairs.
2129
/// </summary>
22-
[JsonProperty("extensions", NullValueHandling = NullValueHandling.Ignore)]
30+
[JsonPropertyName("extensions")]
31+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
2332
public List<Extension>? Extensions { get; set; }
2433

34+
#region Methods
35+
/// <summary>
36+
/// Use this method to assert an object as a DataItemMapping (or not).
37+
/// </summary>
38+
/// <param name="o"></param>
39+
/// <returns></returns>
40+
public override bool Equals(object? o)
41+
{
42+
var other = o as DataItemMapping;
43+
return other?.Id == Id;
44+
}
45+
46+
/// <summary>
47+
/// Override to get a hash value that represents the identifier.
48+
/// </summary>
49+
/// <returns></returns>
50+
public override int GetHashCode() => Id.GetHashCode();
51+
52+
/// <summary>
53+
/// String override so that the object returns its value ('name of the target data item').
54+
/// When an instance of this class is passed to a method that expects a string, the ToString() method will be called implicitly to convert the object to a string, and the value of the Data Item "Name" property will be returned.
55+
/// </summary>
56+
/// <returns></returns>
57+
public override string ToString()
58+
{
59+
return TargetDataItem.Name;
60+
}
61+
#endregion
2562
}

0 commit comments

Comments
 (0)