0
votes

I'm new to Azure and started an Azure Mobile App Quick-Start (.NET) project.

I'm studying on this blog wrote by Adrian Hall: https://shellmonger.com/2016/05/09/30-days-of-zumo-v2-azure-mobile-apps-day-18-asp-net-authentication/. However, I've been confused by the explanation saying that:

Since this is Entity Framework, I would normally need to do an Entity Framework Code First Migration to get that field onto my database. You can find several walk-throughs of the process online. This isn’t an Entity Framework blog, so I’ll leave that process to better minds than mine. Just know that you have to deal with this aspect when using the ASP.NET backend.

On the next page, https://shellmonger.com/2016/05/11/30-days-of-zumo-v2-azure-mobile-apps-day-19-asp-net-table-controllers/ The demonstration was using SQL syntax to create/manage the Azure SQL Database, such as: CREATE TABLE... and CREATE TRIGGER... and etc.

So, my question is, with either SQL(like the blog sample shown) or Entity Framework:
1) Are they both able to do the exact same stuff?
2) Should I only choose one of those methods only?

1

1 Answers

0
votes

All the methods discussed (code first, model first, database first) provide you with a way to create a SQL database and update the data within it. The end result is the same - a database with data.

The method you pick tends to rely on where you prefer the 'intelligence' for your data to live - with the database or with the code.

  • Do you already have an existing database you'll be using?
    Go database first, so you can automatically generate code and classes from the database.

  • Do you know SQL? Do you prefer to use your database for data only (i.e. no stored procedures or validating data inside the database)?
    Go code first, you have full control of your model from the Code, and its a bit easier to keep databases in sync with your application.

There are a few more considerations that can help skew you to a different method. You can take a look at this blog post from Roland about the pros and cons of each approach. There's also a StackOverflow thread that summarizes the differences between the methods.