Skip to content

Use TryAdd when registering services + add EventStreamId ctor #72

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

Merged
merged 3 commits into from
Apr 10, 2025

Conversation

agehrke
Copy link
Collaborator

@agehrke agehrke commented Apr 10, 2025

Currently the UseCQRS() method does not use TryAdd when registering services - like the AddEventStore() does. This means duplicate registrations when UseCQRS() are invoked multiple time.

Also add a ctor on EventStreamId that allow cheaper "cloning" of an existing EventStreamId - prevents params string[] parts allocation, and subsequent string.Join().

Andreas Gehrke added 3 commits April 10, 2025 11:10
Prevents `string[] parts` allocation, and subsequent `string.Join()`
registrations.

Similarly to AddEventStore().
@christianhelle christianhelle requested a review from Copilot April 10, 2025 09:44
@christianhelle christianhelle added the enhancement New feature or request label Apr 10, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

src/Atc.Cosmos.EventStore.Cqrs/EventStreamId.cs:16

  • The main constructor does not assign the 'Parts' property, which is expected to be equivalent to the input 'parts'. Consider initializing 'Parts' (e.g., this.Parts = parts) to ensure that the test 'Parts_property_must_return_parts' passes.
public EventStreamId(params string[] parts)

Copy link
Member

@christianhelle christianhelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@christianhelle christianhelle merged commit 573748d into atc-net:main Apr 10, 2025
1 check passed
@agehrke agehrke deleted the minor-tweaks branch April 10, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants