CREATE DATABASE statement not allowed within multi-statement transaction

后端 未结 5 1552
不知归路
不知归路 2021-02-13 22:40

I\'m trying to build a quick test that deletes and recreates a database every time it runs. I have the following:

[TestClass]
public class PocoTest
{
    privat         


        
5条回答
  •  情书的邮戳
    2021-02-13 23:30

    You can also use db.Database.ExecuteSqlCommand(TransactionalBehavior.DoNotEnsureTransaction, sqlCommand);

    See https://stackoverflow.com/a/24344654/375114 for details

提交回复
热议问题