Giter VIP home page Giter VIP logo

Comments (4)

gautema avatar gautema commented on May 23, 2024

It looks like Autofac has some built in support for decorators. Maybe you can try it?

I do however find it strange that the builder method don't work as it is. You could try making a builder method for Session instead and see if it works?

Adapters and Decorators

from cqrslite.

ktheeten avatar ktheeten commented on May 23, 2024

Tried it with the Autofac decorator, but still no luck. I opened a question on StackOverflow about this, explaining what I tried.

from cqrslite.

ktheeten avatar ktheeten commented on May 23, 2024

Hi Gaute,

I was able to resolve the circular dependency stuff (was related to NServicebus).

I have another question. In the sample implementation, you register a scoped instance of the CacheRepository. Does this ultimately mean that for every command that is handled, a new CacheRepository is created? So if you then Get an aggregate from the session (and as a consequence from the CacheRepository) would you agree that an aggregate will never be retrieved from the cache, unless you put it in there first within the handler?

So in this code:

      public async Task Handle(DeactivateInventoryItem message)
        {
            var item = await _session.Get<InventoryItem>(message.Id, message.ExpectedVersion);
            item.Deactivate();
            await _session.Commit();
        }

the InventoryItem will not be in the cache? It will be retrieved from the event store however.

Regards
Karl

from cqrslite.

gautema avatar gautema commented on May 23, 2024

Even if the Cache is scoped, both System.Runtime.Caching.MemoryCache used by .NET Full framework and Microsoft.Extensions.Caching.Memory.MemoryCache used by .NET Core stores the events in a globally scoped cache. So it will be cached, but feel free to try with a debugger to make sure.

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.