mysqlasp.netdatabaseazurenosql

Trying to understand which DB option is for me when hosting a web app in Azure


I am in the process of creating my first web application top to bottom as a learning experience which I want to deploy in Azure. I wanted to start this from an Empty web project so I can really see all the core components that make up a web api service.

I have created the application using the template created from this tutorial: http://www.daniellewis.me.uk/2015/03/23/web-api-with-owin-bootstrap-and-angularjs-from-scratch-part-1/

and am in middle of adding user authentication by following this tutorial: http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/

So now I have gotten to the point where I have to add a connection string to my web.config file:

   <connectionStrings>
       <add name="AuthContext" connectionString="Data Source=.\sqlexpress;Initial Catalog=AngularJSAuth;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
  </connectionStrings>

I am assuming (me being a noob) that my application fails because clearly it isn't hooked up to any sort of database server. So now I have gotten to the point where I have to I guess choose my DB option, set it up, create tables?, and then pass in the correct connection string into my web.config.

I figured I would stick as closely to Azure as possible since that is where I will be deploying (developing this application with Angular front end, OWIN C# backend), but I see a few different database options available for me whether it be Azure SQL Database or Azure NoSQL DB.

My database and application needs are:

In this application there will be very few number of user account creations with this information, but alot of reads from the PDF files that are associated with each account.

I am looking mainly for opinions on what DB structure would be correct for me, I obviously have misunderstandings on:


Solution

  • The tutorials you're following build on top of the ASP.NET Identity subsystem, which has a provider model that abstracts the underlying storage of users, etc. In your case the most straightforward approach is to use Azure SQL Database:

    https://azure.microsoft.com/en-us/services/sql-database/

    ...along with the Entity Framework provider referenced in your second link. Azure SQL DB is nice because you can use familiar tools like SQL Management Studio, etc. to set things up and poke around.

    Note that there are other providers out there in the wild, and you're of course free to write your own. For example here's one that talks to MongoDB:

    http://devblog.weshigbee.name/posts/building-a-mongodb-provider-for-the-new-asp.net-identity-framework-part-2-rolestore-and-sample

    Unless you have a compelling reason to choose otherwise, Azure SQL DB is a good place to start.

    As for your PDF storage, you could use Azure SQL for that too but that's not ideal from a cost and performance standpoint. Azure Blob storage is very cheap and well-suited to storing and serving files and binary data. You can store PDF metadata (links to users, URI pointers to specific blobs, etc.) in the SQL DB and keep the actual PDF content in blob storage where its cheaper. You'll have to write some code to keep PDF metadata and content in sync but that's typical for these kinds of polyglot persistence solutions in the cloud.

    http://martinfowler.com/bliki/PolyglotPersistence.html

    So, to answer your questions specifically: