如何在Code First中指定数据库名称?

编程入门 行业动态 更新时间:2024-10-27 21:18:20
本文介绍了如何在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中指定数据库名称?

本文发布于:2023-10-17 11:12:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1500723.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中指   名称   数据库   如何在   Code

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!