且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-02-02 21:45:29

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



http://blogs.msdn.com/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

http://blogs.msdn.com/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