Skip to content

Commit

Permalink
Merge pull request #5 from Shuttle/v20
Browse files Browse the repository at this point in the history
V20
  • Loading branch information
eben-roux authored Feb 2, 2025
2 parents 5b8986a + 73d2b35 commit 7ad462a
Show file tree
Hide file tree
Showing 51 changed files with 504 additions and 842 deletions.
Empty file.
Binary file not shown.
48 changes: 33 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,30 @@ Contains a sql-based `IIdempotenceService` implementation.

## Supported providers

Currently only the `System.Data.SqlClient` and `Microsoft.Data.SqlClient` provider names are supported but this can easily be extended. Feel free to give it a bash and please send a pull request if you *do* go this route. You are welcome to create an issue and assistance will be provided where able.
Currently only the `Microsoft.Data.SqlClient` provider name is supported but this can easily be extended. Feel free to give it a bash and please send a pull request if you *do* go this route. You are welcome to create an issue and assistance will be provided where able.

## Configuration

```c#
services.AddDataAccess(builder =>
{
builder.AddConnectionString("shuttle", "System.Data.SqlClient",
"server=.;database=shuttle;user id=sa;password=Pass!000");
});

services.AddServiceBus(builder => {
builder.Options.Idempotence.ConnectionStringName = "shuttle";
});

services.AddSqlIdempotence();
services
.AddDataAccess(builder =>
{
builder.AddConnectionString("Idempotence", "Microsoft.Data.SqlClient");
})
.AddServiceBus(builder =>
{
configuration.GetSection(ServiceBusOptions.SectionName)
.Bind(builder.Options);
})
.AddIdempotence()
.AddSqlIdempotence(builder =>
{
// defaults
builder.Options.ConnectionStringName = "Idempotence";
builder.Options.Schema = "dbo";

builder.UseSqlServer();
});
```

And the JSON configuration structure:
Expand All @@ -32,10 +40,20 @@ And the JSON configuration structure:
{
"Shuttle": {
"ServiceBus": {
"Idempotence": {
"ConnectionStringName": "connection-string-name"
"Sql": {
"Idempotence": {
"ConnectionStringName": "connection-string-name",
"Schema": "dbo"
}
}
}
}
}
```
```

## Options

| Option | Default | Description |
| --- | --- | --- |
| `ConnectionStringName` | Idempotence | The name of the `ConnectionString` to use to connect to the idempotence store. |
| `Schema` | dbo | The name of the database schema to use when accessing the idempotence tables. |
46 changes: 46 additions & 0 deletions Shuttle.Esb.Sql.Idempotence.Tests/IdempotenceFixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.Data.Common;
using System.Threading.Tasks;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using Shuttle.Core.Data;
using Shuttle.Esb.Idempotence;

namespace Shuttle.Esb.Sql.Idempotence.Tests;

[TestFixture]
public class IdempotenceFixture : Esb.Idempotence.Tests.IdempotenceFixture
{
[SetUp]
public void SetUp()
{
DbProviderFactories.RegisterFactory("Microsoft.Data.SqlClient", SqlClientFactory.Instance);
}

[Test]
[TestCase(false, false)]
[TestCase(false, true)]
[TestCase(true, false)]
[TestCase(true, true)]
public async Task Should_be_able_to_perform_full_processing_async(bool isTransactionalEndpoint, bool enqueueUniqueMessages)
{
await TestIdempotenceProcessingAsync(GetServiceCollection(), isTransactionalEndpoint, enqueueUniqueMessages);
}

private static IServiceCollection GetServiceCollection()
{
return new ServiceCollection()
.AddDataAccess(builder =>
{
builder.AddConnectionString("Idempotence", "Microsoft.Data.SqlClient",
"server=.;database=shuttle;user id=sa;password=Pass!000;TrustServerCertificate=true");
})
.AddSqlIdempotence(builder =>
{
builder.Options.Schema = "Idempotence";
builder.Options.ConnectionStringName = "Idempotence";

builder.UseSqlServer();
});
}
}
63 changes: 0 additions & 63 deletions Shuttle.Esb.Sql.Idempotence.Tests/IdempotenceTest.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Shuttle.Core.Data" Version="17.0.0" />
<PackageReference Include="Shuttle.Esb.Sql.Queue" Version="16.0.0" />
<PackageReference Include="Shuttle.Esb.Tests" Version="15.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Shuttle.Core.Data" Version="20.0.0" />
<PackageReference Include="Shuttle.Esb.Idempotence.Tests" Version="20.0.0" />
<PackageReference Include="Shuttle.Esb.Sql.Queue" Version="20.0.0" />
<PackageReference Include="Shuttle.Esb.Tests" Version="20.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Shuttle.Esb.Sql.Idempotence\Shuttle.Esb.Sql.Idempotence.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shuttle.Esb.Sql.Idempotence\Shuttle.Esb.Sql.Idempotence.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
13 changes: 1 addition & 12 deletions Shuttle.Esb.Sql.Idempotence/.package/AssemblyInfo.cs.template
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
using System.Reflection;
using System.Runtime.InteropServices;

#if NETFRAMEWORK
[assembly: AssemblyTitle(".NET Framework")]
#endif

#if NETCOREAPP
[assembly: AssemblyTitle(".NET Core")]
#endif

#if NETSTANDARD
[assembly: AssemblyTitle(".NET Standard")]
#endif

[assembly: AssemblyTitle(".NET Unified Platform")]
[assembly: AssemblyVersion("#{SemanticVersionCore}#.0")]
[assembly: AssemblyCopyright("Copyright (c) #{Year}#, Eben Roux")]
[assembly: AssemblyProduct("Shuttle.Esb.Sql.Idempotence")]
Expand Down
22 changes: 12 additions & 10 deletions Shuttle.Esb.Sql.Idempotence/.package/Shuttle.NuGetPackager.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PackageTasksPath Condition="'$(PackageTasksPath)' == ''">Shuttle.NuGetPackager.MSBuild.dll</PackageTasksPath>
</PropertyGroup>
<PropertyGroup>
<PackageTasksPath Condition="'$(PackageTasksPath)' == ''">Shuttle.NuGetPackager.MSBuild.dll</PackageTasksPath>
</PropertyGroup>

<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.Prompt" />
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.RegexFindAndReplace" />
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.NuGet.SetNuGetPackageVersions" />
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.Zip" />
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.NuGet.SemanticVersion" />
</Project>
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.Prompt" />
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.RegexFindAndReplace" />
<UsingTask AssemblyFile="$(PackageTasksPath)"
TaskName="Shuttle.NuGetPackager.MSBuild.NuGet.SetNuGetPackageVersions" />
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.Zip" />
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.NuGet.SemanticVersion" />
</Project>
10 changes: 5 additions & 5 deletions Shuttle.Esb.Sql.Idempotence/.package/package.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package>
<metadata>
<id>Shuttle.Esb.Sql.Idempotence</id>
<version>16.0.0</version>
<version>20.0.0</version>
<authors>Eben Roux</authors>
<owners>Eben Roux</owners>
<license type="expression">BSD-3-Clause</license>
Expand All @@ -13,17 +13,17 @@
<repository type="git" url="https://github.com/Shuttle/Shuttle.Esb.Sql.Idempotence.git" />
<projectUrl>https://github.com/Shuttle/Shuttle.Esb.Sql.Idempotence</projectUrl>
<description>Sql-based implementation of IIdempotenceService interface for use with Shuttle.Esb.</description>
<copyright>Copyright (c) 2024, Eben Roux</copyright>
<copyright>Copyright (c) 2025, Eben Roux</copyright>
<tags>idempotence</tags>
<dependencies>
<dependency id="Shuttle.Core.Data" version="17.0.0" />
<dependency id="Shuttle.Esb" version="15.0.0" />
<dependency id="Shuttle.Core.Data" version="20.0.0" />
<dependency id="Shuttle.Esb" version="20.0.0" />
<dependency id="Shuttle.Esb.Idempotence" version="20.0.0" />
</dependencies>
</metadata>
<files>
<file src="..\..\..\.media\logo.png" target="images" />
<file src="..\..\..\README.md" target="docs\" />
<file src="lib\**\*.*" target="lib" />
<file src="scripts\**\*.sql" target="scripts" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@
<file src="..\..\..\.media\logo.png" target="images" />
<file src="..\..\..\README.md" target="docs\" />
<file src="lib\**\*.*" target="lib" />
<file src="scripts\**\*.sql" target="scripts" />
</files>
</package>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7ad462a

Please sign in to comment.