Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ charset=utf-8

# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers=false
csharp_preferred_modifier_order=required, public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
csharp_style_var_elsewhere=false:none
csharp_style_var_for_built_in_types=false:error
dotnet_naming_rule.constants_rule.severity=warning
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Set BUILD_CONFIGURATION
if: startsWith(github.ref, 'refs/tags/')
run: echo "BUILD_CONFIGURATION=Release" >> $GITHUB_ENV
- name: Restore
run: dotnet restore
- name: Build
Expand Down Expand Up @@ -69,8 +72,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Download artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -92,8 +95,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Download artifacts
uses: actions/download-artifact@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions AppCoreNet.EventStore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
LICENSE = LICENSE
README.md = README.md
stylecop.json = stylecop.json
Directory.Packages.props = Directory.Packages.props
NuGet.config = NuGet.config
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9E85A2A1-38E1-4B4F-B32B-06E7856B5C52}"
Expand Down
15 changes: 6 additions & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<!-- GitVersion -->
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PackageReference Include="GitVersion.MsBuild">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -38,7 +38,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -47,6 +47,7 @@
<!-- Code Analysis -->
<PropertyGroup>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)AppCoreNet.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

Expand All @@ -55,19 +56,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PackageReference Include="IDisposableAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="IDisposableAnalyzers" Version="4.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.7.30">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
42 changes: 42 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15" />
<PackageVersion Include="IDisposableAnalyzers" Version="4.0.8" />
<PackageVersion Include="GitVersion.MsBuild" Version="6.3.0" />

<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="FluentAssertions" Version="8.3.0" />
<PackageVersion Include="FluentAssertions.Analyzers" Version="0.34.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.1" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />

<PackageVersion Include="AppCoreNet.Diagnostics.Sources" Version="0.7.0" />
<PackageVersion Include="AppCoreNet.TypeHelpers.Sources" Version="0.7.0" />
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0" />

<PackageVersion Include="System.Text.Json" Version="8.0.5" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />

<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />

<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.17" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.17" />

<PackageVersion Include="AppCoreNet.Extensions.DependencyInjection.Abstractions" Version="0.6.3" />
<PackageVersion Include="AppCoreNet.Data.EntityFrameworkCore" Version="0.6.0" />

<PackageVersion Include="Testcontainers.MsSql" Version="4.6.0" />
</ItemGroup>
</Project>
11 changes: 6 additions & 5 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
workflow: GitFlow/v1
mode: ContinuousDelivery
assembly-versioning-scheme: Major
assembly-file-versioning-scheme: MajorMinorPatchTag
assembly-informational-format: '{SemVer}+{ShortSha}'
continuous-delivery-fallback-tag: 'alpha'
mode: 'ContinuousDeployment'
branches:
main:
label: alpha
increment: Minor
support:
label: alpha
pull-request:
tag: 'pr'
ignore:
sha: []
label: pr
16 changes: 16 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<auditSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</auditSources>
<packageSourceMapping>
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
</packageSourceMapping>
</configuration>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.0",
"version": "9.0.301",
"rollForward": "latestFeature",
"allowPrerelease": false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;netstandard2.0;net462</TargetFrameworks>
<RootNamespace>AppCoreNet.EventStore</RootNamespace>
<Description>Provides public API for the AppCore .NET event store.</Description>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net462' OR '$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'!='net8.0'">
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AppCoreNet.Extensions.DependencyInjection.Abstractions" Version="0.5.1" />
<PackageReference Include="Microsoft.Extensions.Options" />
<PackageReference Include="AppCoreNet.Extensions.DependencyInjection.Abstractions" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/AppCoreNet.EventStore.Abstractions/StreamId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public sealed class StreamId : IEquatable<StreamId>
/// <summary>
/// Gets the special ID which refers to all existing streams.
/// </summary>
public static readonly StreamId All = new ("*");
public static readonly StreamId All = new("*");

/// <summary>
/// Gets the ID value.
Expand Down Expand Up @@ -68,7 +68,7 @@ public StreamId(string id)
public static StreamId Prefix(string prefix)
{
Ensure.Arg.NotEmpty(prefix);
return new ($"{prefix}*");
return new($"{prefix}*");
}

/// <summary>
Expand All @@ -79,7 +79,7 @@ public static StreamId Prefix(string prefix)
public static StreamId Suffix(string suffix)
{
Ensure.Arg.NotEmpty(suffix);
return new ($"*{suffix}");
return new($"*{suffix}");
}

/// <summary>
Expand Down Expand Up @@ -146,5 +146,5 @@ public override int GetHashCode()
/// </summary>
/// <param name="id">The value.</param>
/// <returns>The <see cref="StreamId"/>.</returns>
public static implicit operator StreamId(string id) => new (id);
public static implicit operator StreamId(string id) => new(id);
}
6 changes: 3 additions & 3 deletions src/AppCoreNet.EventStore.Abstractions/StreamPosition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ namespace AppCoreNet.EventStore;
/// <summary>
/// Specifies to read from the start of the stream.
/// </summary>
public static readonly StreamPosition Start = new (StartValue);
public static readonly StreamPosition Start = new(StartValue);

/// <summary>
/// Specifies to read from the end of the stream.
/// </summary>
public static readonly StreamPosition End = new (EndValue);
public static readonly StreamPosition End = new(EndValue);

/// <summary>
/// Gets the value.
Expand Down Expand Up @@ -71,7 +71,7 @@ public override string ToString()
}

/// <inheritdoc />
public string ToString(string? format, IFormatProvider formatProvider)
public string ToString(string? format, IFormatProvider? formatProvider)
{
switch (Value)
{
Expand Down
6 changes: 3 additions & 3 deletions src/AppCoreNet.EventStore.Abstractions/StreamState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ namespace AppCoreNet.EventStore;
/// <summary>
/// Specifies that the stream can be at any position.
/// </summary>
public static readonly StreamState Any = new (AnyValue);
public static readonly StreamState Any = new(AnyValue);

/// <summary>
/// Specifies that the stream should not exist.
/// </summary>
public static readonly StreamState None = new (NoneValue);
public static readonly StreamState None = new(NoneValue);

/// <summary>
/// Gets the value.
Expand Down Expand Up @@ -76,7 +76,7 @@ public override string ToString()
}

/// <inheritdoc />
public string ToString(string? format, IFormatProvider formatProvider)
public string ToString(string? format, IFormatProvider? formatProvider)
{
switch (Value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace AppCoreNet.EventStore.Subscriptions;
/// </summary>
public sealed class EventHandlerSubscriptionOptions
{
internal List<Func<IServiceProvider, IEventHandler>> EventHandlerFactories { get; } = new ();
internal List<Func<IServiceProvider, IEventHandler>> EventHandlerFactories { get; } = new();

/// <summary>
/// Adds the specified factory to create an <see cref="IEventHandler"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public sealed class SubscriptionId : IEquatable<SubscriptionId>
/// <summary>
/// Gets the special ID which refers to all existing subscriptions.
/// </summary>
public static readonly SubscriptionId All = new ("*");
public static readonly SubscriptionId All = new("*");

/// <summary>
/// Gets the ID value.
Expand Down Expand Up @@ -68,7 +68,7 @@ public SubscriptionId(string id)
public static SubscriptionId Prefix(string prefix)
{
Ensure.Arg.NotEmpty(prefix);
return new ($"{prefix}*");
return new($"{prefix}*");
}

/// <summary>
Expand All @@ -79,7 +79,7 @@ public static SubscriptionId Prefix(string prefix)
public static SubscriptionId Suffix(string suffix)
{
Ensure.Arg.NotEmpty(suffix);
return new ($"*{suffix}");
return new($"*{suffix}");
}

/// <summary>
Expand Down Expand Up @@ -155,5 +155,5 @@ public override int GetHashCode()
/// </summary>
/// <param name="id">The value.</param>
/// <returns>The <see cref="SubscriptionId"/>.</returns>
public static implicit operator SubscriptionId(string id) => new (id);
public static implicit operator SubscriptionId(string id) => new(id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ namespace AppCoreNet.EventStore.Subscriptions;
/// </summary>
public sealed class SubscriptionOptions
{
private readonly Dictionary<SubscriptionId, Subscriber> _subscribers = new ();
private readonly Dictionary<SubscriptionId, Subscriber> _subscribers = new();

internal Dictionary<SubscriptionId, EventHandlerSubscriptionOptions> EventHandlerOptions { get; } = new ();
internal Dictionary<SubscriptionId, EventHandlerSubscriptionOptions> EventHandlerOptions { get; } = new();

/// <summary>
/// Gets or sets the batch size when processing event subscriptions.
Expand Down Expand Up @@ -105,7 +105,7 @@ public SubscriptionOptions AddEventHandlers(
Ensure.Arg.NotNull(subscriptionId);
Ensure.Arg.NotNull(configure);

if (_subscribers.TryGetValue(subscriptionId, out Subscriber subscriber))
if (_subscribers.TryGetValue(subscriptionId, out Subscriber? subscriber))
{
if (subscriber.StreamId != streamId)
throw new InvalidOperationException();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0;netstandard2.0;net462</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<Description>Provides public API for the AppCore .NET event store.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AppCoreNet.Data.EntityFrameworkCore" Version="0.5.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net462' OR '$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[3.1.32,4.0.0)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[6.0.26,9.0.0)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[8.0.1,9.0.0)" />
<ItemGroup>
<PackageReference Include="AppCoreNet.Data.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading