{ "organisationId" : 1, "lineTotal" : 1.45 }
{ "organisationId" : 1, "lineTotal" : 0.99 }
{
"ageCheck" : false
}
public void AddSaleLine(Decimal lineTotal)
{
//Only include what we want
var saleLine = new {
type = "saleLine" // no assembly type needed
lineTotal
}
var @event = JsonConvert.Serialise(saleLine);
}
public void AddSaleLineWithAgeCheck(Decimal lineTotal)
{
//Only include what we want
var saleLine = new {
type = "saleLine" // no assembly type needed
lineTotal,
ageCheck = true
}
var @event = JsonConvert.Serialise(saleLine);
}
--
You received this message because you are subscribed to the Google Groups "Event Store" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-store...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/event-store/b171f770-4af6-468d-b169-078b2effc3b9%40googlegroups.com.
{
"type": "saleTransactionLineAddedEvent",
"lineDateTime": "05/03/2020 12:05:08",
"lineNumber": 2,
"barcode": "3501170815038",
"quantity": 1.0,
"lineTotal": 3.0,
"retailPricePerUnit": 3.0,
"vatRate": 0.2,
"costPerUnit": 1.0
}
{
"type": "saleTransactionLineAddedEvent",
"lineDateTime": "05/03/2020 12:05:08",
"lineNumber": 1,
"barcode": "3501170815038",
"quantity": 1.0,
"lineTotal": 0.0,
"retailPricePerUnit": 3.0,
"vatRate": 0.2,
"costPerUnit": 1.0,
"reason": "Price Enquiry"
}
I would argue you have the same event here, but a newer version. This is a common problem in event sourcing, when you need to capture something in an event that you haven't been previously. You can either create a new version of the event and "upgrade" older events as you replay or if things are so different, create a new event. In your case of just adding a reason field, I would just do a new version and assume reason is null for all your old events as you replay.
{
"lineTotal" : 0,
"reason" : null
}
{
"lineTotal" : 0,
"reason" : "Price Override"
}