简体   繁体   中英

|DataDirectory| for EF Update-Database

How to define |DataDirectory| for WPF project that is in Connection String for EF command "Update-Migration"? There are a lot solutions to add : AppDomain.CurrentDomain.SetData("DataDirectory", ***); but it works only if application runs. I do not run application - just want to create and migrate Database

我有同样的问题,可能是一些不常见的行为,但是最好的是,我发现了什么-它是为update-database命令指定连接字符串参数:

update-database -ConnectionString "Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\User\Database.mdf;Integrated Security=True" -ConnectionProviderName System.Data.SqlClient 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM