Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release of new minor version v1.14 #56

Merged
merged 25 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
53c019c
Set version to '1.14-preview'
ATCBot Apr 21, 2024
5310531
Merge branch 'release/v1.13'
ATCBot Apr 21, 2024
e8c8a6a
Merge branch 'stable'
ATCBot Apr 21, 2024
c2834dc
chore(deps): upgrade packages to resolve security vulnerability warnings
christianhelle Nov 19, 2024
4397cce
chore: target .net 9.0 in test projects
christianhelle Nov 19, 2024
9749f61
chore: switch to default code analysis mode
christianhelle Nov 19, 2024
aca86d2
chore: resolve xunit warning regarding bypassing parallelization limits
christianhelle Nov 19, 2024
d01ca2c
chore(deps): upgrade Microsoft.Azure.Cosmo to v3.46.0
christianhelle Nov 20, 2024
b1958ff
chore: disable newtonsoft.json check
christianhelle Nov 20, 2024
65d62b3
chore: use .net 9.0 in builb agents
christianhelle Nov 20, 2024
53abb86
fix: failing tests due to serialization indentation options
christianhelle Nov 20, 2024
8d5e4a6
docs: add getting started sample project
christianhelle Dec 5, 2024
22fabdd
chore: remove directory props/target for samples
christianhelle Dec 5, 2024
4ed3fe1
Merge pull request #52 from atc-net/update-packages
LarsSkovslund Dec 5, 2024
3e09337
Merge pull request #53 from atc-net/getting-started-docs
LarsSkovslund Dec 5, 2024
13505cb
chore: remove unused using and fix test name spelling
TomMalow Dec 6, 2024
d43d2c7
feat: add new StreamDeleter
TomMalow Dec 6, 2024
c1320a5
feat(ManagementClient): Implement DeleteStreamAsync
TomMalow Dec 6, 2024
a81829c
docs: update change log
TomMalow Dec 6, 2024
e72fc3b
Merge pull request #54 from atc-net/feature/delete-stream
LarsSkovslund Dec 6, 2024
b870a94
chore(test): add unit testing of CommandProcessor
TomMalow Dec 8, 2024
e786689
feat: add StreamVersion of the stream to CommandContext
TomMalow Dec 8, 2024
3926429
docs: update change log
TomMalow Dec 8, 2024
62b0d2a
Merge pull request #55 from atc-net/feature/command-handler-context-s…
LarsSkovslund Dec 9, 2024
4da39a6
Set version to '1.14'
ATCBot Dec 9, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
- name: ⚙️ Setup GIT versioning
uses: dotnet/[email protected]

- name: ⚙️ Setup dotnet 7.0.x
- name: ⚙️ Setup dotnet 9.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
dotnet-version: '9.0.x'

- name: 🛠️ Building library in release mode
run: dotnet pack -c Release -o ${GITHUB_WORKSPACE}/packages -p:ContinuousIntegrationBuild=true -p:publicrelease=true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ jobs:
with:
setAllVars: true

- name: ⚙️ Setup dotnet 7.0.x
- name: ⚙️ Setup dotnet 9.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
dotnet-version: '9.0.x'

- name: 🛠️ Update changelog
uses: thomaseizinger/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
with:
setAllVars: true

- name: ⚙️ Setup dotnet 7.0.x
- name: ⚙️ Setup dotnet 9.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
dotnet-version: '9.0.x'

- name: 🛠️ Building libraries in release mode
run: dotnet build -c release -p:ContinuousIntegrationBuild=true
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Implement `IEventStoreManagementClient.DeleteStreamAsync` using the newly released `DeleteAllItemsByPartitionKeyStreamAsync` method in the Cosmos SDK.
- Extend `CommandContext` with the current `StreamVersion` of the stream.

## [1.13.3] - 2024-04-21

### Added
Expand Down Expand Up @@ -187,4 +192,4 @@ services.AddEventStore(builder =>

[1.3.3]: https://github.com/atc-net/atc-cosmos-eventstore/compare/v1.2.9...v1.3.3

[1.2.9]: https://github.com/atc-net/atc-cosmos-eventstore/compare/v1.1.3...v1.2.9
[1.2.9]: https://github.com/atc-net/atc-cosmos-eventstore/compare/v1.1.3...v1.2.9
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</PropertyGroup>

<PropertyGroup Label="Analyzer settings">
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<AnalysisMode>Default</AnalysisMode>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
Expand Down
80 changes: 0 additions & 80 deletions sample/.editorconfig

This file was deleted.

31 changes: 31 additions & 0 deletions sample/GettingStarted/Commands/CreateCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Atc.Cosmos.EventStore.Cqrs;

namespace GettingStarted;

public record CreateCommand(string Id, string Name, string Address)
: CommandBase<SampleEventStreamId>(new SampleEventStreamId(Id));

public class CreateCommandHandler :
ICommandHandler<CreateCommand>,
IConsumeEvent<CreateCommand>
{
private bool created;

public void Consume(CreateCommand evt, EventMetadata metadata)
{
this.created = true;
}

public ValueTask ExecuteAsync(
CreateCommand command,
ICommandContext context,
CancellationToken cancellationToken)
{
if (!created)
{
context.AddEvent(new AddedEvent(command.Name, command.Address));
}

return ValueTask.CompletedTask;
}
}
44 changes: 44 additions & 0 deletions sample/GettingStarted/Commands/DeleteCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Atc.Cosmos.EventStore.Cqrs;

namespace GettingStarted;

public record DeleteCommand(string Id, string Reason)
: CommandBase<SampleEventStreamId>(new SampleEventStreamId(Id));

public class DeleteCommandHandler :
ICommandHandler<DeleteCommand>,
IConsumeEvent<AddedEvent>,
IConsumeEvent<DeletedEvent>
{
private bool created;
private bool deleted;

public void Consume(AddedEvent evt, EventMetadata metadata)
{
this.created = true;
}

public void Consume(DeletedEvent evt, EventMetadata metadata)
{
this.deleted = true;
}

public ValueTask ExecuteAsync(
DeleteCommand command,
ICommandContext context,
CancellationToken cancellationToken)
{
if (!created)
{
throw new InvalidOperationException("Cannot delete non-existing entity.");
}

if (deleted)
{
throw new InvalidOperationException("Already deleted.");
}

context.AddEvent(new DeletedEvent(command.Reason));
return ValueTask.CompletedTask;
}
}
44 changes: 44 additions & 0 deletions sample/GettingStarted/Commands/UpdateNameCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Atc.Cosmos.EventStore.Cqrs;

namespace GettingStarted;

public record UpdateNameCommand(string Id, string Name)
: CommandBase<SampleEventStreamId>(new SampleEventStreamId(Id));

public class UpdateNameCommandHandler :
ICommandHandler<UpdateNameCommand>,
IConsumeEvent<AddedEvent>,
IConsumeEvent<NameChangedEvent>
{
private bool created;
private string? currentName;

public void Consume(AddedEvent evt, EventMetadata metadata)
{
created = true;
currentName = evt.Name;
}

public void Consume(NameChangedEvent evt, EventMetadata metadata)
{
currentName = evt.NewName;
}

public ValueTask ExecuteAsync(
UpdateNameCommand command,
ICommandContext context,
CancellationToken cancellationToken)
{
if (!created)
{
throw new InvalidOperationException("Cannot change name on non-existing entity.");
}

if (currentName != command.Name)
{
context.AddEvent(new NameChangedEvent(currentName!, command.Name));
}

return ValueTask.CompletedTask;
}
}
44 changes: 44 additions & 0 deletions sample/GettingStarted/ConsoleHostedService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Atc.Cosmos.EventStore.Cqrs;
using Microsoft.Extensions.Hosting;

namespace GettingStarted;

public class ConsoleHostedService(ICommandProcessorFactory commandProcessorFactory) : IHostedService
{
public async Task StartAsync(CancellationToken cancellationToken)
{
var id = Guid.NewGuid().ToString("N");

await commandProcessorFactory
.Create<CreateCommand>()
.ExecuteAsync(
new CreateCommand(id, "First", "Address 1"),
cancellationToken);

await commandProcessorFactory
.Create<UpdateNameCommand>()
.ExecuteAsync(
new UpdateNameCommand(id, "Second"),
cancellationToken);

await commandProcessorFactory
.Create<UpdateNameCommand>()
.ExecuteAsync(
new UpdateNameCommand(id, "Third"),
cancellationToken);

await commandProcessorFactory
.Create<DeleteCommand>()
.ExecuteAsync(
new DeleteCommand(id, "Deleted"),
cancellationToken);

await commandProcessorFactory
.Create<DeleteCommand>()
.ExecuteAsync(
new DeleteCommand(id, "Deleted"),
cancellationToken);
}

public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}
6 changes: 6 additions & 0 deletions sample/GettingStarted/Events/AddedEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Atc.Cosmos.EventStore.Cqrs;

namespace GettingStarted;

[StreamEvent("added-event:v1")]
public record AddedEvent(string Name, string Address);
6 changes: 6 additions & 0 deletions sample/GettingStarted/Events/AddressChangedEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Atc.Cosmos.EventStore.Cqrs;

namespace GettingStarted;

[StreamEvent("address-changed-event:v1")]
public record AddressChangedEvent(string OldAddress, string NewAddress);
6 changes: 6 additions & 0 deletions sample/GettingStarted/Events/DeletedEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Atc.Cosmos.EventStore.Cqrs;

namespace GettingStarted;

[StreamEvent("deleted-event:v1")]
public record DeletedEvent(string Reason);
6 changes: 6 additions & 0 deletions sample/GettingStarted/Events/NameChangedEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Atc.Cosmos.EventStore.Cqrs;

namespace GettingStarted;

[StreamEvent("name-changed-event:v1")]
public record NameChangedEvent(string OldName, string NewName);
17 changes: 17 additions & 0 deletions sample/GettingStarted/GettingStarted.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Atc.Cosmos" Version="1.1.40" />
<PackageReference Include="Atc.Cosmos.EventStore.Cqrs" Version="1.12.6" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
</ItemGroup>

</Project>
Loading
Loading