-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: SOFTURE COMMON CORRELATION - RELEASE NEW VERSION TO NUGET.ORG | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
publishing: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: ⚙️ Install dotnet | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 8.0.100 | ||
|
||
- name: 🔗 Restore dependencies | ||
run: dotnet restore ./API | ||
|
||
- name: 📂 Create new nuget package | ||
run: dotnet pack --no-restore -c Release -o ./artifacts /p:PackageVersion=${{ github.ref_name }} /p:Version=${{ github.ref_name }} ./API/SOFTURE.Common.Correlation/SOFTURE.Common.Correlation.csproj | ||
continue-on-error: false | ||
|
||
- name: 🚀 Push new nuget package | ||
run: dotnet nuget push ./artifacts/SOFTURE.Common.Correlation.${{ github.ref_name }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace SOFTURE.Common.Correlation.Consts; | ||
|
||
public static class CorrelationConsts | ||
{ | ||
public const string CorrelationHeader = "X-Correlation-Id"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using SOFTURE.Common.Correlation.Providers; | ||
|
||
namespace SOFTURE.Common.Correlation | ||
{ | ||
public static class DependencyInjection | ||
{ | ||
public static IServiceCollection AddCommonCorrelationProvider(this IServiceCollection services) | ||
{ | ||
services.AddScoped<ICorrelationProvider, CorrelationProvider>(); | ||
|
||
return services; | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
API/SOFTURE.Common.Correlation/Generators/CorrelationGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using SOFTURE.Common.Correlation.ValueObjects; | ||
|
||
namespace SOFTURE.Common.Correlation.Generators; | ||
|
||
public static class CorrelationGenerator | ||
{ | ||
public static CorrelationId Generate() => new(Guid.NewGuid()); | ||
} |
18 changes: 18 additions & 0 deletions
18
API/SOFTURE.Common.Correlation/Providers/CorrelationProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using SOFTURE.Common.Correlation.ValueObjects; | ||
|
||
namespace SOFTURE.Common.Correlation.Providers; | ||
|
||
public interface ICorrelationProvider | ||
{ | ||
CorrelationId? Get(); | ||
void Set(CorrelationId correlationId); | ||
} | ||
|
||
public sealed class CorrelationProvider : ICorrelationProvider | ||
{ | ||
private CorrelationId? CorrelationId { get; set; } | ||
|
||
public CorrelationId? Get() => CorrelationId; | ||
|
||
public void Set(CorrelationId correlationId) => CorrelationId = correlationId; | ||
} |
46 changes: 46 additions & 0 deletions
46
API/SOFTURE.Common.Correlation/SOFTURE.Common.Correlation.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' "> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0"/> | ||
<PackageReference Include="SOFTURE.Results" Version="0.0.9"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' "> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0"/> | ||
<PackageReference Include="SOFTURE.Results" Version="0.0.9"/> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>SOFTURE.Common.Correlation</AssemblyName> | ||
<AssemblyTitle>$(AssemblyName)</AssemblyTitle> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<LangVersion>latest</LangVersion> | ||
<Title>$(AssemblyName)</Title> | ||
<Authors>SOFTURE</Authors> | ||
<Copyright>Copyright (c) 2024 $(Authors)</Copyright> | ||
<Description>SOFTURE - Correlation</Description> | ||
<EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
<PackageId>$(AssemblyName)</PackageId> | ||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | ||
<PackageProjectUrl>https://github.com/SOFTURE/API</PackageProjectUrl> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<PackageReleaseNotes>See $(PackageProjectUrl)/blob/master/CHANGELOG.md for release notes.</PackageReleaseNotes> | ||
<PackageTags>SOFTURE</PackageTags> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<RepositoryType>Git</RepositoryType> | ||
<RepositoryUrl>$(PackageProjectUrl)</RepositoryUrl> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\README.md" Pack="true" PackagePath="\"/> | ||
<None Include="..\..\LICENSE" Pack="true" PackagePath="\"/> | ||
</ItemGroup> | ||
|
||
</Project> |
10 changes: 10 additions & 0 deletions
10
API/SOFTURE.Common.Correlation/ValueObjects/CorrelationId.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace SOFTURE.Common.Correlation.ValueObjects; | ||
|
||
public sealed record CorrelationId(Guid Value) | ||
{ | ||
public static implicit operator CorrelationId(Guid value) => new(value); | ||
public static implicit operator Guid(CorrelationId id) => id.Value; | ||
public static implicit operator string(CorrelationId id) => id.Value.ToString(); | ||
|
||
public static CorrelationId Parse(string value) => new(Guid.Parse(value)); | ||
} |