简体   繁体   中英

How to develop in MVC (C#) with existing database

I'm building an application that will use a large database that's currently hosted on Azure SQL. I also want to use ASP.net Identity. Additionally, my local machine cannot connect to the Azure SQL database due to security restrictions (I can't remove these, they are corporate IT policies).

When developing, do either of the following make sense? Or is there another option that I'm unaware of?

  1. Add the fields from the large database, and maybe a few rows of sample data, to my localdb that's being used by default by Visual Studio? If I do this, how do I migrate over to the existing Azure database when it's time to go live?

  2. Host the development application on Azure. This wouldn't be ideal, given that I'd need to upload the application with every change.

  1. You could do that for small scale testing and demonstration purposes yes. Essentially to interact with the database in ASP you create an instance of the database with the reference link to the local one. Providing they are identical, you could simply just change the link to the company database when it's time to go live. You should be careful however as working with relatively small datasets means everything will run relatively smoothly and quickly but if your coding is sloppy, it could slow the entire thing down with big data sets.
  2. As for developing, I would personally develop on a small scale yourself locally until you're happy with the result. However, before you do a full scale launch, I would do a pilot launch in a small section to highlight any bugs you may have pushed and halt this on azure. Then after you've ruled out the obvious bugs, you've got a much safer launch.

to work in an develop-release separated environment:

  1. you need a intranet copy of remote database first, then use code first approach to continue working,
  2. reverse your database to code-first:
  3. Enable database migrate: https://msdn.microsoft.com/en-us/library/dn579398(v=vs.113).aspx
  4. Add identity framework to intranet database with code first: https://docs.microsoft.com/en-us/aspnet/identity/overview/getting-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project
  5. carefully maintenance migration code in later tasks, remote database will be auto-updated after your code is released

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