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

When getting aggregate roots - it should allow for ConceptAs<> that are compatible for conversion to EventSourceId for the constructor #819

Open
einari opened this issue Apr 24, 2017 · 0 comments

Comments

@einari
Copy link
Contributor

einari commented Apr 24, 2017

It increases readability and looks generally much better if we can allow having the actual domain concept as the constructor parameter for AggregateRoots / EventSources:

public class Messaging : AggregateRoot
{
    public Messaging(Inbox inbox) : base((Guid)inbox) // Conversion to Guid - as we have implicit conversion to EventSourceId from Guid
    {
    }
}

Consider also if it makes sense to have a generic AggregateRoot:

public class Messaging : AggregateRoot<Inbox>
{
    public Messaging(Inbox inbox) : base(inbox) 
    {
    }
}

This would also make it easier for the next step; applying events:

public class Messaging : AggregateRoot<Inbox>
{
    public Messaging(Inbox inbox) : base(inbox) 
    {
    }

    public void Receive(....)
    {
         Apply(new MessageReceived(eventSourceId) {....});
    }
}

with an event:

public class MessageReceived : Event
{
    public MessageReceived(Inbox inbox) : base((Guid)inbox) // Similar casting - or use generic here as well
    {
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant