Closed house9 closed 13 years ago
Hmm, I'm not sure about this shouldn't you create mementos of the entities too? An aggregate root is just an Entity that is marked as root (despite the fact that they are separate classes in NCQRS).
I'm not sure we should be serializing classes that are supposed to encapsulate their state, perhaps we just need a more extensive ISnapshottable concept that extends to the entities.
fair enough, it was a quick fix so that I could save my AR with Entities into the snapshot
The current snapshot strategy uses the mementos pattern. Which I think is the cleanest solution. Yet,this can be a strategy as well. It's easy, doesn't need any extra code but it's hard to incompatible snapshots due changes in the entity. But this isn't really a big problem, since you can just throw them away and build again.
Any thoughts?
ok, I think I am understanding this better (maybe?), I just read up on Memento pattern for a basic parent/child relationship, say Project (AR) with many Tasks (Entities) are you saying I would make Task implement ISnapshotable and save that collection under the snapshot of the Project instead of directly saving Task entities in the snapshot?
Entity and EntityMappedByConvention are now marked Serializable, this allows snapshotting of AR that contain entities.