'EF Core Non Committing DB Class

In Spring Ado there is a base class to do non-committing database actions.

This works in Test methods so that data sent into the DB under test conditions isn't committed.

While the test is running this data can be accessed. When the test finishes, the transaction rolls back.

Does EF Core 6 have such a feature? I'm hoping not to have to write a bunch of commits and then clear them out in all my tests.

I am aware setting up a mock Repo, etc. will also work. I am just wondering if EF Core might have the option directly to do non-committing actions on the DB?

I can work around by figuring out what FK tables to insert data, etc. to perform a test and then remove the data in a Test Cleanup method. For what I have to do it's not that hard to do it this way.

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source