I have done a lot of reading about Event Sourcing in my spare time recently.
I understand that it is for situations (Bounded Contexts?) where the business is interested in how an entity arrived in its current state. The classic example is a bank, which would not store your current balance, but instead a collection of debits and credits, which show how your balance was arrived at.
I was looking at some code recently. Please see the DDL below:
CREATE TABLE Query (ID int IDENTITY, User ID int, Salary int, Deposit int, Term int, value int, primary key (ID)) CREATE TABLE Mortgage (ID int, Description VARCHAR(30), primary key (ID)) CREATE TABLE MortgageQuery (QueryID int foreign key references Query (ID), MortgageID int foreign key Mortgage references (ID), PRIMARY KEY (QueryID, MortgageID)) A Person is offered mortgages based on their Salary; Deposit; term; house value etc (among others).
A user could query multiple times like this:
INSERT INTO Query (UserID, salary, deposit,term,value) values (1,30000,35000,30,150000) INSERT INTO Query (UserID, salary, deposit,term,value) values (1,30000,38000,30,150000) INSERT INTO Query (UserID, salary, deposit,term,value) values (1,30000,25000,30,150000) INSERT INTO Query (UserID, salary, deposit,term,value) values (1,30000,35000,25,150000) INSERT INTO Query (UserID, salary, deposit,term,value) values (1,30000,38000,25,150000) INSERT INTO Query (UserID, salary, deposit,term,value) values (1,30000,25000,25,150000) Notice that the same user (1) has queried multiple times with different criteria each time. Here it is not as if the term has arrived at 25 years or the deposit has arrived at 25,000. Therefore I do not believe this scenario would benefit from Event Sourcing/Event Store. Have I understood this correctly?