Entity Framework 6 (code first) entity versioning and auditing

前端 未结 3 617
傲寒
傲寒 2020-12-30 09:15

I\'m looking at using Entity Framework 6.1.1 with SQL Server 2008 R2.

Currently I\'m creating my models and database using the code-first EF feature. My basic use-c

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-30 09:57

    I would say this is a good candidate for the event sourcing pattern mentioned in a DDD architecture. You never change your entity table but always inserting.

    In that way, when you need an specific version you just re-play all events and apply them to the entity from version 0 to the version you are looking for. Scalability can be solved with entity snapshots.

    Second approach is also valid.

    Reference: http://microservices.io/patterns/data/event-sourcing.html

提交回复
热议问题