Giter VIP home page Giter VIP logo

Comments (8)

gautema avatar gautema commented on June 24, 2024

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.

bdongus avatar bdongus commented on June 24, 2024

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.

gautema avatar gautema commented on June 24, 2024

from cqrslite.

bdongus avatar bdongus commented on June 24, 2024

I will downlaod the source and debug this. Enjoy your vacation.

from cqrslite.

bdongus avatar bdongus commented on June 24, 2024

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.

bdongus avatar bdongus commented on June 24, 2024

ooops ... misclicked and closed the issue accidently.

from cqrslite.

gautema avatar gautema commented on June 24, 2024

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.

bdongus avatar bdongus commented on June 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.