开发者

Use DataContext.CreateDatabase in SQL Azure

开发者 https://www.devze.com 2023-02-15 17:20 出处:网络
I am trying to re-deploy my ASP.NET MVC3开发者_StackOverflow社区 application across several different environments and would like to try using SQL Azure. I\'d like to use my existing LINQ structure an

I am trying to re-deploy my ASP.NET MVC3开发者_StackOverflow社区 application across several different environments and would like to try using SQL Azure. I'd like to use my existing LINQ structure and CreateDatabase to create these databases.

I am wondering how I can use CreateDatabase with SQL Azure since the USE statement doesn't work on the platform.

Please answer with any suggestions or if there might be a better way to do this.


http://msdn.microsoft.com/en-us/library/ee336274.aspx

Important: The CREATE DATABASE statement must be the only statement in a Transact-SQL batch. You must be connected to the master database when executing the CREATE DATABASE statement.

You'll have to find a way to fit in this premise. Maybe it's not possible.


Have you actually tried executing this?

I've deployed nHibernate apps to SQL Azure - these apps call CREATE DATABASE somewhere inside the nHibernate layer and they work OK.

Best advice I can give is to try it - then come back with any specific errors you see. There may be some changes to make, but I think these should be small.

0

精彩评论

暂无评论...
验证码 换一张
取 消