Giter VIP home page Giter VIP logo

Comments (3)

saisworld avatar saisworld commented on August 24, 2024

I'm facing same problem while using Actors. I have a DBContext instance and its registered to container using InstancePerdenpendency and when I create multiple actors during runtime, I get the error - "ExceptionMessage":"The context cannot be used while the model is being created. This exception may be thrown if the context is used inside the OnModelCreating method or if the same context instance is accessed by multiple threads concurrently. Note that instance members of DbContext and related classes are not guaranteed to be thread safe."

So looks like same instance of DbContext object is being served by Autofac container to multiple threads as dbcontext class is not thread safe we are having this problem. Is there a lifetimescope that is equivalent to InstancePerRequest for ServiceFabric as well?

from autofac.servicefabric.

alexmg avatar alexmg commented on August 24, 2024

It is possible to achieve "per request" scoping by using the various relationship types that are part of core Autofac. Have a read through issue #4 for the details and some example code. 😃

from autofac.servicefabric.

tillig avatar tillig commented on August 24, 2024

I added some quick docs around the Service Fabric integration which includes this faux per-request info so hopefully it'll help folks in the future.

from autofac.servicefabric.

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.