Comments (8)
Hi. From what I see, everything looks correct.
Does it work if you don’t use snapshots? So just use the repository? If so, my guess is that there is something wrong in the snapshots restore method or the event store.
It’s very hard for me to know without being able to debug the code, but as said, it looks correct from here.
from cqrslite.
Hi,
It did work before switching the aggregate to a snapshot aggregate.
The snapshot store returns the snapshot with version 125. The event store then returns an empty array. There is no event beyond version 125. The "RestoreFromSnapshot" method on my aggregate root is never called.
Guess that's the problem. Any ideas why this happens?
from cqrslite.
from cqrslite.
I will downlaod the source and debug this. Enjoy your vacation.
from cqrslite.
Inside TryRestoreAggregateFromSnapshot
aggregate.Invoke("Restore", snapshot);
is executed. In the DynamicInvoker
var exists = _cachedMembers.TryGetValue(hash, out var method);
if (exists) return method?.Invoke(obj, args);
exists is true, but method is null.
This happens because I use different types in the store (SnapshotEntry) and in the snapshot aggregate (GenericSnapshot). In the SQL database I store all types of snapshots in the same structure (aggregate data as JSON string). Using the I SnapshotEntry everywhere would to leak infrastructure details into the domain.
Might not be the best idea to handle this. Which leads me to a question: What is the recommended way to work with snapshots seralizing/deserializing them to/from some kind of disk storage? Is there a working sample?
from cqrslite.
ooops ... misclicked and closed the issue accidently.
from cqrslite.
Hi. There are as far as I know no working samples in the wild. I have only used it in closed source projects myself, and haven't actually used snapshotting in a while.
I haven't ever tried using a generic snapshot or anything not made for each aggregate so I'm a bit lost here.
Would it work with regular dynamic invoking? If so, maybe I could find a way to invoke if method is null in the code quoted above.
from cqrslite.
Sorry for the delay. I think my way isn't as smart as I thought. I will use dedicated snapshots per aggregate. If I stumble upon something else, I'll ask again.
Have a nice week.
from cqrslite.
Related Issues (20)
- Concurrency errors HOT 7
- Error EventIdIncorrectException in the new version HOT 2
- Another article about CQRSlite HOT 1
- Where are the query and event handlers being registered? HOT 1
- Not sure if this is a bug or intentional... HOT 3
- Question about events and new commands HOT 4
- How to "rollback" to a specific version? HOT 2
- Are async handlers waited? HOT 1
- Untyped Save<T> when calling from Session HOT 2
- Project maintained?
- How to handle the version property in react or angular frontend? HOT 3
- Aggregate may change identity during history load HOT 5
- You can no longer return IServiceProvider from ConfigureServices as in Web example from .NET Core 3 HOT 9
- Implement snapshot HOT 4
- DSL for CQRSlite HOT 3
- Service fabric doesn't support GenericHostBuilder HOT 5
- Commands, events and being idempotent? HOT 2
- Entity Framework Problem HOT 6
- Add netstandard2.1 and correct dependencies to match the standards HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cqrslite.