簡體   English   中英

如何首先在特定路徑中通過實體框架代碼創建 sql 數據庫

[英]how can i create sql database by entity framework code first in specific path

我首先使用以下字符串在實體框架代碼中成功創建了我的數據庫:

Data Source=DESKTOP-PL8EDEA;Initial Catalog=MyDB;Integrated Security=True;TimeOut=3600

此頂部連接字符串在 sql server 數據庫的默認地址中創建數據庫,但我希望將數據庫保存在我想要的路徑中我也嘗試了此字段,但沒有成功

Data Source=DESKTOP-PL8EDEA;Initial Catalog=|D:\MyFolder|\MyDB;Integrated Security=True;TimeOut=3600

您可以指定路徑:

Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;Trusted_Connection=Yes;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM