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

IEvent Interface Question #64

Closed
GoneFishern opened this issue Jan 1, 2018 · 1 comment
Closed

IEvent Interface Question #64

GoneFishern opened this issue Jan 1, 2018 · 1 comment

Comments

@GoneFishern
Copy link

Just starting out with CQRS concepts and implementation so I am still learning how all this fits together. My current understanding of events is that they should be immutable. Doesn't having IEvent implement {set;} on each of the properties mean that an event is mutable by definition or does that come down to the implementation of the event itself.

public interface IEvent : IMessage
    {
        Guid Id { get; set; }
        int Version { get; set; }
        DateTimeOffset TimeStamp { get; set; }
    }
@gautema
Copy link
Owner

gautema commented Jan 7, 2018

Hi. Sorry for the late answer, but I've been away for the holidays.

You are correct that the events should be immutable and that a setter on the events makes them mutable which is not ideal. The setters are however necessary for the framework to be able to make sure id, version and timestamp is set and correct. While this may not be ideal, the important thing is to make sure the event store never changes a saved event.

@gautema gautema closed this as completed Jan 10, 2018
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

2 participants