Skip to content

Commit d080a20

Browse files
committed
add tuple defs and floss some warnings
tuple definitions are in `GlobalUsings.cs`, which makes the list definitions and their items easier
1 parent 1a17384 commit d080a20

16 files changed

+116
-147
lines changed

DataWarehouseAutomation/DataWarehouseAutomation/DataWarehouseAutomation.csproj

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
<Authors>Roelant Vos</Authors>
99
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1010
<Title>Data Warehouse Automation</Title>
11-
<PackageProjectUrl>https://roelantvos.com/blog/interface-for-data-warehouse-automation/</PackageProjectUrl>
11+
<PackageProjectUrl>https://github.com/data-solution-automation-engine/data-warehouse-automation-metadata-schema</PackageProjectUrl>
1212
<PackageIcon>Ravos-logo.png</PackageIcon>
1313
<PackageReadmeFile>index.md</PackageReadmeFile>
14-
<RepositoryUrl>https://github.com/RoelantVos/data-warehouse-automation-metadata-schema</RepositoryUrl>
14+
<RepositoryUrl>https://github.com/data-solution-automation-engine/data-warehouse-automation-metadata-schema</RepositoryUrl>
1515
<PackageTags>data warehouse; etl; data integration; data warehouse automation</PackageTags>
1616
<Description>The generic schema for Data Warehouse Automation covers the efforts towards defining a standard interface to exchange Data Warehouse Automation and ETL generation metadata.
1717

@@ -25,12 +25,32 @@ The interface itself is a Json schema definition (JSDL) with examples on how to
2525
<Pack>True</Pack>
2626
<PackagePath>\</PackagePath>
2727
</None>
28+
<None Include="..\Images\Ravos-logo.png">
29+
<Pack>True</Pack>
30+
<PackagePath>\</PackagePath>
31+
</None>
2832
</ItemGroup>
2933

3034
<ItemGroup>
3135
<PackageReference Include="Handlebars.Net" Version="2.1.4" />
3236
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
3337
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.15" />
38+
<PackageReference Include="Roslynator.Analyzers" Version="4.12.4">
39+
<PrivateAssets>all</PrivateAssets>
40+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
41+
</PackageReference>
42+
<PackageReference Include="Roslynator.CodeFixes" Version="4.12.4">
43+
<PrivateAssets>all</PrivateAssets>
44+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
45+
</PackageReference>
46+
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.12.4">
47+
<PrivateAssets>all</PrivateAssets>
48+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
49+
</PackageReference>
50+
<PackageReference Include="Roslynator.Refactorings" Version="4.12.4">
51+
<PrivateAssets>all</PrivateAssets>
52+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
53+
</PackageReference>
3454
</ItemGroup>
3555

3656
</Project>

DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/BusinessKeyDefinition.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ public class BusinessKeyDefinition
2222
/// <summary>
2323
/// Items that define the Business Key e.g. the collection of columns for a business key.
2424
/// The integer value defines the order of the components in the business key definition.
25-
/// The order is significant, and can be recorded as part of the tuple definition.
25+
/// The order is significant, and is recorded as part of the tuple definition.
2626
/// </summary>
2727
[JsonPropertyName("businessKeyComponents")]
28-
public List<Tuple<int, IDataItem>> BusinessKeyComponents { get; set; } = new();
28+
public List<BusinessKeyComponents>? BusinessKeyComponents { get; set; }
2929

3030
/// <summary>
3131
/// An optional label for the end result e.g. the target business key attribute.

DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/Cardinality.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public override bool Equals(object? obj)
7777
/// <returns>The Name</returns>
7878
public override string ToString()
7979
{
80-
return Name;
80+
return Name ?? string.Empty;
8181
}
8282
#endregion
8383
}
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System.Buffers.Text;
2-
using System.Collections.Generic;
3-
using System.Xml.Linq;
4-
5-
namespace DataWarehouseAutomation.DwaModel;
1+
namespace DataWarehouseAutomation.DwaModel;
62

73
/// <summary>
84
/// The possible range for a from/to component for the cardinality.
@@ -13,4 +9,4 @@ public class CardinalityRange
139
{
1410
public string? Min { get; set; }
1511
public string? Max { get; set; }
16-
}
12+
}

DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class DataItem : IDataItem
1818
public string Name { get; set; } = "NewDataItem";
1919

2020
/// <summary>
21-
/// The data object to which the data item belongs. This can be used to construct fully qualified names.
21+
/// The <see cref="IDataObject"/> to which the data item belongs. This can be used to construct fully qualified names.
2222
/// </summary>
2323
[JsonPropertyName("dataObject")]
2424
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]

DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataItemMapping.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace DataWarehouseAutomation.DwaModel;
22

33
/// <summary>
4-
/// The individual column-to-column mapping.
4+
/// The individual <see cref="IDataItem"/> to <see cref="IDataItem"/>, column-to-column mapping.
55
/// </summary>
66
public class DataItemMapping
77
{
@@ -13,7 +13,7 @@ public class DataItemMapping
1313
public string? Id { get; set; }
1414

1515
[JsonPropertyName("sourceDataItems")]
16-
public List<IDataItem> SourceDataItems { get; set; } = new();
16+
public List<IDataItem> SourceDataItems { get; set; } = [];
1717

1818
[JsonPropertyName("targetDataItem")]
1919
public IDataItem TargetDataItem { get; set; } = new DataItem() { Name = "newTargetDataItem" };

DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataItemQuery.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ public class DataItemQuery : IDataItem
1616
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
1717
public string Name { get; set; } = string.Empty;
1818

19-
// convenience property for parent, derived on json load, never stored in the json file
20-
// Can be either a DataObject or a DataQuery when the DataQuery is a DataItem level thing
19+
/// <summary>
20+
/// The <see cref="IDataObject"/> to which the data item belongs. This can be used to construct fully qualified names.
21+
/// </summary>
2122
[JsonIgnore(Condition = JsonIgnoreCondition.Always)]
2223
public IDataObject? DataObject { get; set; }
2324

DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataObject.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
/// <summary>
44
/// The definition of a data set, file, or table.
5-
/// The Data Object can be the 'source' or 'target' in a Data Object Mapping.
6-
/// A Data Object which acts as target in one mapping, can be a source in another mapping, building up the data logistics lineage.
5+
/// The Data Object can be the 'source' or 'target' in a <see cref="DataObjectMapping"/>.
6+
/// A Data Object which acts as target in one mapping, can be a source in another mapping,
7+
/// building up the data logistics lineage.
78
/// </summary>
89
public class DataObject : IMetadata, IDataObject
910
{
@@ -42,15 +43,14 @@ public class DataObject : IMetadata, IDataObject
4243
/// </summary>
4344
[JsonPropertyName("businessKeyDefinitions")]
4445
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
45-
public List<Tuple<int,BusinessKeyDefinition>>? BusinessKeyDefinitions { get; set; }
46-
46+
public List<BusinessKeyDefinitions>? BusinessKeyDefinitions { get; set; }
4747

4848
/// <summary>
4949
/// Any relationship to other data objects.
5050
/// </summary>
5151
[JsonPropertyName("relationships")]
5252
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
53-
public List<Tuple<int,Relationship>>? Relationships { get; set; }
53+
public List<Relationships>? Relationships { get; set; }
5454

5555
/// <summary>
5656
/// Free-form and optional classification for the Data Object.

DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataObjectMapping.cs

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -56,27 +56,14 @@ public class DataObjectMapping : IMetadata
5656
/// </summary>
5757
[JsonPropertyName("relatedDataObjects")]
5858
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
59-
public List<Tuple<int, Relationship>>? Relationships { get; set; }
59+
public List<Relationships>? Relationships { get; set; }
6060

61-
private List<IDataItem> _dataItems = [];
6261
/// <summary>
6362
/// The collection of Data Items <see cref="IDataItem"/> specifically associated with this Data Object Mapping,
6463
/// used as source/target Data Items/Queries for the mapping or the Mappings BKCM as needed.
6564
/// </summary>
6665
[JsonPropertyName("dataItems")]
67-
[JsonPropertyOrder(order: 55)]
68-
public List<IDataItem> DataItems
69-
{
70-
get
71-
{
72-
return _dataItems;
73-
}
74-
set
75-
{
76-
_dataItems = value;
77-
isSorted = false;
78-
}
79-
}
66+
public List<IDataItem>? DataItems { get; set; }
8067

8168
/// <summary>
8269
/// The collection of individual attribute (column or query) mappings.
@@ -91,7 +78,7 @@ public List<IDataItem> DataItems
9178
/// </summary>
9279
[JsonPropertyName("businessKeyDefinitions")]
9380
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
94-
public List<Tuple<int, BusinessKeyDefinition>>? BusinessKeyDefinitions { get; set; }
81+
public List<BusinessKeyDefinitions>? BusinessKeyDefinitions { get; set; }
9582

9683
/// <summary>
9784
/// Any filtering that needs to be applied to the source-to-target mapping.
@@ -123,25 +110,6 @@ public List<IDataItem> DataItems
123110
#endregion
124111

125112
#region Json Representation
126-
private bool isSorted = false;
127-
128-
/// <summary>
129-
/// Sort all the lists in the metadata object
130-
/// </summary>
131-
public void SortLists()
132-
{
133-
if (!isSorted)
134-
{
135-
isSorted = true;
136-
SourceDataObjects.Sort();
137-
RelatedDataObjects.Sort();
138-
DataItemMappings.Sort();
139-
BusinessKeyDefinitions.Sort();
140-
Classifications.Sort();
141-
Extensions.Sort();
142-
}
143-
}
144-
145113
/// <summary>
146114
/// Get the standard Json representation
147115
/// </summary>

DataWarehouseAutomation/DataWarehouseAutomation/DwaModel/DataObjectQuery.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,11 @@ public class DataObjectQuery : IDataObject
3535
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
3636
public string? QueryLanguage { get; set; }
3737

38-
private List<IDataItem> _dataItems = [];
3938
/// <summary>
4039
/// The collection of Data Items <see cref="IDataItem"/> associated with this Data Object Query.
4140
/// </summary>
4241
[JsonPropertyName("dataItems")]
43-
[JsonPropertyOrder(order: 40)]
44-
public List<IDataItem> DataItems
45-
{
46-
get
47-
{
48-
return _dataItems;
49-
}
50-
set
51-
{
52-
_dataItems = value;
53-
}
54-
}
42+
public List<IDataItem>? DataItems { get; set; }
5543

5644
/// <summary>
5745
/// The connection for the query.
@@ -74,7 +62,7 @@ public List<IDataItem> DataItems
7462
/// </summary>
7563
[JsonPropertyName("relationships")]
7664
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
77-
public List<Tuple<int, Relationship>>? Relationships { get; set; }
65+
public List<Relationships>? Relationships { get; set; }
7866

7967
/// <summary>
8068
/// Free-form and optional classification for the Data Query for use in generation logic (evaluation).
@@ -119,7 +107,7 @@ public override bool Equals(object? obj)
119107
/// String override so that the object returns its value ('name').
120108
/// 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.
121109
/// </summary>
122-
/// <returns></returns>
110+
/// <returns>The Name</returns>
123111
public override string ToString()
124112
{
125113
return Name;

0 commit comments

Comments
 (0)