Get aggregate ID from AggregateState #1089
Answered
by
rasmus
ryan-nguyen-contemi
asked this question in
Q&A
-
In read model, we can get aggregate ID like this: public void Apply(IReadModelContext context, IDomainEvent<OrderAggregate, OrderId, OrderCreatedEvent> domainEvent)
{
this.Id = context.ReadModelId;
} What is the equivalent of the above code in |
Beta Was this translation helpful? Give feedback.
Answered by
rasmus
Mar 18, 2025
Replies: 1 comment
-
Since you get the aggregate ID via the constructor when the aggregate is created, you can create the state within the constructor and pass the ID. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ryan-nguyen-contemi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since you get the aggregate ID via the constructor when the aggregate is created, you can create the state within the constructor and pass the ID.