We are developing an application for a real estate renting/leasing company using ASP Core 8, EF Core 8 and and MSSQL
and using MS Azure
for hosting.
When rent or lease a property
we create a contract
between the Landlord and the tenant.
What we need to do is we need to save the state of the property
entity, the state of the landlord
entity and the state of the tenant
entity at the time of creating a contract so we have no information mismatch at a later point in time even if any of the entities (property, landlord or tenant) have been updated later on.
For example:
let’s assume create a contract on 12-June 2024.
The rent amount of the property when creating the contract was 1000 USD, and after 3 years the rent was changed to 2500 USD, and the landlord of the property was John at the time of creating the contract and after 3 years it was sold to Tom.
When i still view the contract created on 12-June 2024 after 4 years i should see the rent as 1000 USD and landlord as John for the contract which was created on 12-June 2024
what we are looking for is something like storing a snapshot of the entities at the time of creating the contract.
So far i have read about storing the entities as serialized JSON in a new table in the database.
Any other better solution would be great!