开发者

SqlServices.Install is locking the database?

开发者 https://www.devze.com 2023-03-07 03:01 出处:网络
I\'m trying to do some integration test in a csharp project, I\'m using Entity Framework 4. In the tes开发者_如何转开发t setup I\'m recreating the database with

I'm trying to do some integration test in a csharp project, I'm using Entity Framework 4. In the tes开发者_如何转开发t setup I'm recreating the database with

        _container.DeleteDatabase();
        _container.CreateDatabase();

And then adding the asp.net membership to the database with

       SqlServices.Install(
          "MyDb",
          SqlFeatures.All,
          ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);

Everything works fine in the first test, but the setup for the second test fails, with a message that can't drop the database because is in use. If I don't try to create the membership structure all the tests works fine.

There is any way to free the database?

Thanks In Advance


I found a solution!

I add Pooling=False in the connection string in the membership configuration and now is working

0

精彩评论

暂无评论...
验证码 换一张
取 消