Skip to content

Commit

Permalink
Merge pull request #31 from Avanade/template-fixes
Browse files Browse the repository at this point in the history
Fix code comment that results in compile error when uncommented. Fix/…
  • Loading branch information
chullybun authored May 8, 2023
2 parents 9735bf3 + 2be74a7 commit 241a9f6
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Represents the **NuGet** versions.

## v2.0.1
- *Fixed:* `TableConfig.BatchTrackingTable` JSON serialization name corrected.
- *Fixed:* Commented Azure Service Bus event publishing code in template solution corrected.

## v2.0.0
- **Note:** This version contains a number of breaking changes and generated artefact file name changes; all existing generated artefacts should be deleted and re-generated. Where possible it is recommended to create new using the template solution and copy across existing non-generated artefacts, such as the NTangle YAML etc.
- *Enhancement:* Removed need for `UseSqlServer` for `CodeGenConsole` as this is the only supported database option. New `UseDeploymentOption` to enable deployment option override; defaults to `DeploymentOption.DbEx`.
Expand Down
6 changes: 6 additions & 0 deletions docs/SqlServer.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Given the above, it is generally _recommended_ that CDC enablement is explicity

<br/>

### CDC vs Change Tracking

Microsoft SQL Server provides two change tracking capabilities, namely CDC and [Change Tracking](https://learn.microsoft.com/en-us/sql/relational-databases/track-changes/track-data-changes-sql-server#Tracking). Change Tracking differs in that it _only_ captures the fact that rows in a table were changed, but doesn't capture the data that was changed. Given the multiple related table hierarchy triggering that _nTangle_ enables the joining columns as well as the primary key columns are required to be captured; this is not possible with Change Tracking as it only captures the primary key columns; therefore, making it unsuitable for walking back up the join hierarchy to determine the primary entity (aggregate root) that was changed. And largely impossible where a child table row has been physically deleted.

<br/>

## Architecture

The following represents the high-level conceptual run-time architecture for a solution leveraging _nTangle_.
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/join.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Category | Description
[`JoinTo`](#JoinTo) | Provides the _join to_ configuration.
[`Database`](#Database) | Provides the _database_ configuration.
[`Columns`](#Columns) | Provides the _Columns_ configuration.
[`DotNet`](#DotNet) | Provides the _.NET_ configuration.
[`.NET`](#NET) | Provides the _.NET_ configuration.
[`IdentifierMapping`](#IdentifierMapping) | Provides the _identifier mapping_ configuration.
[`Collections`](#Collections) | Provides related child (hierarchical) configuration.

Expand Down Expand Up @@ -66,7 +66,7 @@ Property | Description

<br/>

## DotNet
## .NET
Provides the _.NET_ configuration.

Property | Description
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Property | Description
`executeStoredProcedure` | The `CDC` _execute_ batch stored procedure name.<br/>&dagger; Defaults to `sp` (literal) + `Name` + `BatchExecute` (literal); e.g. `spNameBatchExecute`.
`completeStoredProcedure` | The `CDC` _complete_ batch stored procedure name.<br/>&dagger; Defaults to `sp` (literal) + `Name` + `BatchComplete` (literal); e.g. `spNameBatchComplete`.
`cdcSchema` | The schema name for the generated `CDC`-related database artefacts.<br/>&dagger; Defaults to `Root.CdcSchema`.
`outboxTableName` | The corresponding `CDC` Batch tracking table name.<br/>&dagger; Defaults to `Name` + `BatchTracking` (literal).
`batchTrackingTable` | The corresponding `CDC` Batch tracking table name.<br/>&dagger; Defaults to `Name` + `BatchTracking` (literal).
`cdcEnable` | Indicates whether to enable `Cdc` within the database for the tables that participate.<br/>&dagger; Defaults to `false`. This option can be overridden for each underlying table referenced.

<br/>
Expand Down
2 changes: 1 addition & 1 deletion schemas/ntangle.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
"title": "The schema name for the generated 'CDC'-related database artefacts.",
"description": "Defaults to 'Root.CdcSchema'."
},
"outboxTableName": {
"batchTrackingTable": {
"type": "string",
"title": "The corresponding 'CDC' Batch tracking table name.",
"description": "Defaults to 'Name' + 'BatchTracking' (literal)."
Expand Down
12 changes: 6 additions & 6 deletions src/NTangle/Config/JoinConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace NTangle.Config
[CodeGenCategory("JoinTo", Title = "Provides the _join to_ configuration.")]
[CodeGenCategory("Database", Title = "Provides the _database_ configuration.")]
[CodeGenCategory("Columns", Title = "Provides the _Columns_ configuration.")]
[CodeGenCategory("DotNet", Title = "Provides the _.NET_ configuration.")]
[CodeGenCategory(".NET", Title = "Provides the _.NET_ configuration.")]
[CodeGenCategory("IdentifierMapping", Title = "Provides the _identifier mapping_ configuration.")]
[CodeGenCategory("Collections", Title = "Provides related child (hierarchical) configuration.")]
public class JoinConfig : ConfigBase<RootConfig, TableConfig>, ITableReference
Expand Down Expand Up @@ -155,37 +155,37 @@ public class JoinConfig : ConfigBase<RootConfig, TableConfig>, ITableReference

#endregion

#region DotNet
#region .NET

/// <summary>
/// Gets or sets the .NET model name.
/// </summary>
[JsonProperty("model", DefaultValueHandling = DefaultValueHandling.Ignore)]
[CodeGenProperty("DotNet", Title = "The .NET model name.",
[CodeGenProperty(".NET", Title = "The .NET model name.",
Description = "Defaults to `Name`.")]
public string? Model { get; set; }

/// <summary>
/// Gets or sets the .NET property name.
/// </summary>
[JsonProperty("property", DefaultValueHandling = DefaultValueHandling.Ignore)]
[CodeGenProperty("DotNet", Title = "The .NET property name.",
[CodeGenProperty(".NET", Title = "The .NET property name.",
Description = "Defaults to `Model` where `JoinCardinality` is `OneToOne`; otherwise, it will be the `Model` pluralized.")]
public string? Property { get; set; }

/// <summary>
/// Gets or sets the list of `Column` names that should be included (in addition to the primary key) for a logical delete.
/// </summary>
[JsonProperty("includeColumnsOnDelete", DefaultValueHandling = DefaultValueHandling.Ignore)]
[CodeGenPropertyCollection("DotNet", Title = "The list of `Column` names that should be included (in addition to the primary key) for a logical delete.",
[CodeGenPropertyCollection(".NET", Title = "The list of `Column` names that should be included (in addition to the primary key) for a logical delete.",
Description = "Where a column is not specified in this list its corresponding .NET property will be automatically cleared by the `CdcDataOrchestrator` as the data is technically considered as non-existing.")]
public List<string>? IncludeColumnsOnDelete { get; set; }

/// <summary>
/// Gets or sets the list of `Column` names that should be excluded from the generated ETag (used for the likes of duplicate send tracking).
/// </summary>
[JsonProperty("excludeColumnsFromETag", DefaultValueHandling = DefaultValueHandling.Ignore)]
[CodeGenPropertyCollection("DotNet", Title = "The list of `Column` names that should be excluded from the generated ETag (used for the likes of duplicate send tracking).",
[CodeGenPropertyCollection(".NET", Title = "The list of `Column` names that should be excluded from the generated ETag (used for the likes of duplicate send tracking).",
Description = "Defaults to `CodeGeneration.CdcExcludeColumnsFromETag`.")]
public List<string>? ExcludeColumnsFromETag { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/NTangle/Config/TableConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public class TableConfig : ConfigBase<RootConfig, RootConfig>, ITableReference
/// <summary>
/// Gets or sets the corresponding `Cdc` Batch tracking table name.
/// </summary>
[JsonProperty("outboxTableName", DefaultValueHandling = DefaultValueHandling.Ignore)]
[JsonProperty("batchTrackingTable", DefaultValueHandling = DefaultValueHandling.Ignore)]
[CodeGenProperty("Database", Title = "The corresponding `CDC` Batch tracking table name.",
Description = "Defaults to `Name` + `BatchTracking` (literal).")]
public string? BatchTrackingTable { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/NTangle/NTangle.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>NTangle</RootNamespace>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>NTangle Developers</Authors>
<Company>Avanade</Company>
Expand Down
2 changes: 1 addition & 1 deletion tools/NTangle.Template/NTangle.Template.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
<Authors>NTangle Developers</Authors>
<Company>Avanade</Company>
<Description>NTangle template solution for use with 'dotnet new'.</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NTangle" Version="2.0.0" />
<PackageReference Include="NTangle" Version="2.0.1" />
</ItemGroup>
<ItemGroup>
<None Update="ntangle.yaml">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tables:
]
},
# Set up non CDC inner join between Address and AddressType, and include only Code column as Type.
{ name: AddressType, joinTo: Address, type: Inner, includeColumns: [ Code ], aliasColumns: [ Code^Type],
{ name: AddressType, joinTo: Address, type: Inner, includeColumns: [ Code ], aliasColumns: [ Code^Type ],
on: [
{ name: AddressTypeId }
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NTangle" Version="2.0.0" />
<PackageReference Include="NTangle" Version="2.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NTangle" Version="2.0.0" />
<PackageReference Include="NTangle" Version="2.0.1" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
Expand All @@ -15,7 +15,6 @@
<ItemGroup>
<Folder Include="Data\" />
<Folder Include="Entities\" />
<Folder Include="Events\" />
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal static void Main(string[] args) => Host.CreateDefaultBuilder(args)
.AddSqlServerEventOutboxHostedService(sp => new EventOutboxDequeue(sp.GetRequiredService<IDatabase>(), sp.GetRequiredService<LoggerEventSender>(), sp.GetRequiredService<ILogger<EventOutboxDequeue>>()));
// Adds the ServiceBusSender to publish the events to Azure Service Bus, and starts the event outbox dequeue hosted service.
//services.AddSingleton(sp => new Az.ServiceBusClient(sp.GetRequiredService<AppNameSettings>().ServiceBusConnectionString)))
//services.AddSingleton(sp => new Az.ServiceBusClient(sp.GetRequiredService<AppNameSettings>().ServiceBusConnectionString))
// .AddScoped<ServiceBusSender>()
// .AddSqlServerEventOutboxHostedService(sp => new EventOutboxDequeue(sp.GetRequiredService<IDatabase>(), sp.GetRequiredService<ServiceBusSender>(), sp.GetRequiredService<ILogger<EventOutboxDequeue>>()));
})
Expand Down

0 comments on commit 241a9f6

Please sign in to comment.