Coder Social home page Coder Social logo

Reset of multiple different DBs from same Checkpoint is not supported - DeleteSql is cached on initial call to Reset about respawn HOT 1 CLOSED

jbogard avatar jbogard commented on August 11, 2024 3
Reset of multiple different DBs from same Checkpoint is not supported - DeleteSql is cached on initial call to Reset

from respawn.

Comments (1)

BlairMcc avatar BlairMcc commented on August 11, 2024

I have tried this but it does not seem to be working for me either, at least using DbConnections

private static Dictionary<string, Checkpoint> _databaseCheckpoints = new Dictionary<string, Checkpoint>();

CreateCheckPoints

            using (var context = new Context1())
            {
                _databaseCheckpoints.Add(context.Database.Connection.Database, new Checkpoint());
            }

            using (var context = new Context2())
            {
                _databaseCheckpoints.Add(context.Database.Connection.Database, new Checkpoint());
            }

            using (var context = new Context3())
            {
                _databaseCheckpoints.Add(context.Database.Connection.Database, new Checkpoint());
            }

CheckpointReset

        public static void RestoreSnapshot(DbContext context)
        {         
            var dbName = context.Database.Connection.Database;
            if (_databaseCheckpoints.ContainsKey(dbName))
            {
                _databaseCheckpoints[dbName].Reset(context.Database.Connection);
            }
        }

edit - got it working by using context.Database.Connection.ConnectionString instead, plus it might have been working all along as I wasn't awaiting the reset call

from respawn.

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.