jaduff / LabLog

Software for recording physical users of computers in a lab environment.
MIT License
0 stars 1 forks source link

Events must have an author - or do they? #23

Closed jaduff closed 6 years ago

jaduff commented 6 years ago

Events such as assigning a student to a room, and logging damage definitely need to record who entered the event. It could be argued that all events need an author. Should this be done in LabEvent, or in the EventBody section of particular events?

simonjduff commented 6 years ago

Probably LabEvent since it applies to all events. Can add things like IP address, authenticated user etc

jaduff commented 6 years ago

Given this code:

public String Name {
            get { return _name; }
            set
            {
                if (_eventHandler == null)
                {
                    return;
                }
                _name = value;
                var @event = LabEvent.Create(Id,
                    ++Version,
                    new RoomNameChangedEvent(_name)
                );
                _eventHandler(@event);
            }
        }

If I add the requirement to have an Event Author, I'll need to pass it to the setter above. How do you do that? Or, if you don't do that, would I need to create a custom method: Room.SetName(EventAuthor, RoomName) {}?

simonjduff commented 6 years ago

Yeah, I'd look at using a method rather than a Property setter

jaduff commented 6 years ago

Ok, will work on implementing EventAuthor