Skip to content
Discussion options

You must be logged in to vote

@elexisvenator, Marten can't "know" that the concrete UserNameSetEvent is meant to be a base class, so it can't set up the generic event handler, plus Marten is building a filter on specific event types as an optimization. The quick fix is like so:

    // I introduced this
    public interface IUserName
    {
        string Name { get; }
    }

    public record UserNameSetEvent(string Name) : IUserName;
    public record UserNameAndAgeSetEvent(string Name, int Age) : UserNameSetEvent(Name);

    public record DeletedEvent;
    public record UserDeletedEvent : DeletedEvent;

    public class UserAggregate
    {
        public Guid Id { get; set; }
        public string Name { get; set; }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@elexisvenator
Comment options

Answer selected by elexisvenator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2623 on July 06, 2023 13:16.