实体框架4.3托管SQL Server无数据库创建权限

编程入门 行业动态 更新时间:2024-10-28 21:25:01
本文介绍了实体框架4.3托管SQL Server无数据库创建权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我的SQL Server由我的主机提供商托管。这意味着我没有权限重新创建(或创建)数据库。

这导致我对EF 4的问题 - 它认为表丢失,他们是谁我认为是由于无法重新创建数据库而导致的。

要概述:本地开发,首次运行到托管服务器,切换连接字符串,反对托管服务器,错误说无效的对象名称'dbo.Products'。

我有权创建除DB之外的其他任何东西

我在这个假设中是否正确,如何解决这个问题?

解决方案

在EF 4.3中,使用视频工作室中的工具菜单项中的软件包管理器控制台。这将允许您使用迁移来生成数据库脚本。更多信息

blogs.msdn/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations -walkthrough.aspx

你当然可以自己创建一个下载并创建脚本

My SQL Server is hosted by my hosting provider. This means that I don't have permission to recreate (or create) the database.

This is causing me a problem with EF 4 - it thinks the tables are missing, which they are. I think is caused by not being able to recreate the database.

To recap: developed locally, moving to hosted server for first time run, switched the connection string, run against the hosted server, error saying Invalid object name 'dbo.Products'.

I have permission to create anything else apart from the DB

Am I correct in this assumption and how do I work around this?

解决方案

In EF 4.3 you can use the Package Manager Console from the tools menu item in visual studio. This will allow you to use migrations to generate a DB script. More info here

blogs.msdn/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx

You could of course create a drop and create script yourself

更多推荐

实体框架4.3托管SQL Server无数据库创建权限

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

发布评论

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

>www.elefans.com

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