本文介绍了如何在Code First中指定数据库名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何告诉EF什么来命名数据库以及在哪里放置?
How do I tell EF what to name the database and where to put it?
如果Web.Config中没有连接字符串,则尝试将它在本地的SQLEXPRESS服务器中,但我想把它放在一个已知的SQL Server上,并将其命名为我想要的。任何建议?
If there is no connection string in the Web.Config, it tries to put it in the local SQLEXPRESS Server, but I want to put it out on a known SQL Server and name it what I want. Any suggestions?
推荐答案在app.config / web.config中创建与上下文相同名称的连接字符串, EF将使用该数据库。
Create a connection string in the app.config/web.config with the same name as the context and the EF will use that DB.
更多推荐
如何在Code First中指定数据库名称?
发布评论