Coder Social home page Coder Social logo

Comments (4)

lesair avatar lesair commented on August 11, 2024

@dennisroche , I stumbled upon this as exception as well while trying to Checkpoint.Reset an SQL database in Azure I forgot to create its tables. My first thought was "please don't tell me Respawn has issues with SQL databases in Azure", but then I discarded that thought because it really made no sense, and started digging into the aforementioned exception, until I reached this issue and I realized I forgot to initialize my database.

I believe a more meaningful error message or exception would have led me to the root cause faster.

from respawn.

Inspyro avatar Inspyro commented on August 11, 2024

As a workaround you can decorate the DbAdapter like so:

new Checkpoint
{
  SchemasToInclude = ..., TablesToIgnore = ...
  DbAdapter = new EmptyCommandHandlingDbAdapterDecorator(DbAdapter.SqlServer)
}

and override the BuildDeleteCommandText method:

public string BuildDeleteCommandText (GraphBuilder builder)
{
  var command = _dbAdapter.BuildDeleteCommandText(builder);

  if (string.IsNullOrEmpty(command))
    throw new NothingToClearException();

  return command;
}

but I would also appreciate that this bug was being fixed by throwing a better exception out of the box

from respawn.

majouleblanc avatar majouleblanc commented on August 11, 2024

this issue still happening on v5.0.1, i managed to work around it by just replacing
await Fixture.Checkpoint.Reset(Database.ConnectionStringAdmin);
by
VotingContext.Votes.RemoveRange(VotingContext.Votes);
await VotingContext..SaveChangesAsync();

VotingContext.ChangeTracker.Entries()
.Where(e => e.Entity != null).ToList()
.ForEach(e => e.State = EntityState.Detached);

from respawn.

jbogard avatar jbogard commented on August 11, 2024

PR welcome!

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.