-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from dolittle/aggregate-root-di
Enable dependency injection for aggregate roots
- Loading branch information
Showing
14 changed files
with
173 additions
and
76 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
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
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,24 @@ | ||
// Copyright (c) Dolittle. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using Dolittle.SDK.Events; | ||
|
||
namespace Dolittle.SDK.Aggregates; | ||
|
||
/// <summary> | ||
/// Exception that gets thrown when an <see cref="AggregateRootOperations{TAggregate}.Perform(System.Action{TAggregate},System.Threading.CancellationToken)"/> failed. | ||
/// </summary> | ||
public class AggregateRootOperationFailed : Exception | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="AggregateRootOperationFailed"/> class. | ||
/// </summary> | ||
/// <param name="aggregateRootType">The <see cref="Type"/> of the <see cref="AggregateRoot"/>.</param> | ||
/// <param name="eventSource">The <see cref="EventSourceId"/> of the aggregate.</param> | ||
/// <param name="error">The inner <see cref="Exception"/> reason for failure.</param> | ||
public AggregateRootOperationFailed(Type aggregateRootType, EventSourceId eventSource, Exception error) | ||
: base($"Failed to perform operation on {aggregateRootType} aggregate with event source {eventSource}", error) | ||
{ | ||
} | ||
} |
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
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
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,22 @@ | ||
// Copyright (c) Dolittle. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using Dolittle.SDK.Events; | ||
|
||
namespace Dolittle.SDK.Aggregates; | ||
|
||
/// <summary> | ||
/// Exception that gets thrown when trying to get the <see cref="EventSourceId"/> for an <see cref="AggregateRoot"/> where the value has not been set yet. | ||
/// </summary> | ||
public class EventSourceIdOnAggregateRootNotReady : Exception | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="EventSourceIdOnAggregateRootNotReady"/> class. | ||
/// </summary> | ||
/// <param name="aggregateRootType">The <see cref="Type"/> of the aggregate root.</param> | ||
public EventSourceIdOnAggregateRootNotReady(Type aggregateRootType) | ||
: base($"Event Source has not yet been set on the {aggregateRootType} aggregate root instance. This typically happens when trying to use the {nameof(AggregateRoot.EventSourceId)} property in the constructor." + | ||
$" If this is important then all you need to do is to include in the public constructor a parameter with the {typeof(EventSourceId)} type and use that in the bast constructor, then the {nameof(AggregateRoot.EventSourceId)} property will be accessible in the constructor.") | ||
{} | ||
} |
Oops, something went wrong.