How to set up LocalDb for unit tests in Visual Studio 2012 and Entity Framework 5

前端 未结 5 1435
傲寒
傲寒 2020-12-23 16:02

We have a Visual Studio 2012 ASP.NET MVC project using Entity Framework 5.

There are some unit tests that depend on a database. Setting up the app.config file in the

5条回答
  •  悲哀的现实
    2020-12-23 16:29

    Try:

    AppDomain.CurrentDomain.SetData(
      "DataDirectory", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ""));
    

    This will Create Db File on /bin/Debug/yourdbname.mdf

提交回复
热议问题