简体   繁体   中英

Multi Tenant Application - Auto Create Database

I have a multi tenant application which I am trying to deploy on Azure using a web app package.

When a user registers for a new account at that moment a database is created for them and this works flawlessly on my development machine with SQL Server 2014.

Do I need to configure the database server on Azure to allow this, if so how?

Not creating the database may be caused by a timeout. See this post: Entity Framework Database Initialization: Timeout when initializing new Azure SqlDatabase

If you need a new database to be created when someone signs up, you can better create the database before firing up Entity Framework.

This can be done using either T-SQL (1) when connected to the master database of your server or using the Azure Sql Managment Libraries (2). I would recommend option two since it will allow you to depend on a nice abstraction rather than interacting with the database directly.

1: https://msdn.microsoft.com/en-us/library/dn268335.aspx

2: https://www.nuget.org/packages/Microsoft.Azure.Management.Sql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM