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

Support non-entity event raising #5

Closed
charlessolar opened this issue Aug 5, 2016 · 1 comment
Closed

Support non-entity event raising #5

charlessolar opened this issue Aug 5, 2016 · 1 comment

Comments

@charlessolar
Copy link
Owner

In certain circumstances it would be useful to allow posting events not apart of an entity.

Take the example:

You have an "EmployeeType" field, which presents the user with a list of already stored employee types or allows them to add another. Making this type of object an entity or aggregate doesn't make sense as it only has one field "Name" with 1 or 2 commands (create, destroy).

Instead of that we can make a

_uow.Raise<Events.EmployeeType>("STREAM", x => {
x.Name= Name;
});

feature to support directly posting an event to a named stream.

The event consumers would see the event and store the employee type name in a table which would be given to the user next time he searches for an employee type.
No need for a domain object at all - because there is no business logic for these objects

@charlessolar
Copy link
Owner Author

For slightly more complicated objects that still do not have business logic but can be used IN business logic - EX: Something like a "CanSelect" property to mark the EmployeeType as selectable

It would be better to allow them to read and write POCOs to a stream.

_uow.For<EmployTypePoco>("STREAM", x => { 
x.Name = Name;
x.Selectable = true;
});

For reading/writing we would simply read/append to the last "event" on the stream. Kind of similar to a snapshot.

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