Most of my development experience has been with desktop applications, so I have to admit my knowledge of web development is pretty light. I’ve had a chance this week to begin digging into ASP.NET MVC 4, along with the many cool features made available by hosting a site in Azure. Although I’ve maintained a cursory knowledge of both, I hadn’t had a chance to really try them out, and certainly didn’t feel comfortable taking on large projects in either (or even scoping such efforts). My exploration this week has left me much more at ease with both.
I was able to hit several topics this week:
- Basic MVC 4 development
- MVC routing
- MVC validation
- Code-first Entity Framework development
- Code-First EF Migration
- Using OAuth providers for for login credentials
- Deployment to an Azure Web Site
- Use of Azure SQL Database
I was impressed with how straightforward and sensible the MVC 4 approach is. The use of convention-based coordination of controllers and views makes it extremely simple to quickly set up a functional site. And the default plumbing created automatically by Visual Studio really helps a lot. I’m not sure if I’d yet be comfortable coding everything from scratch at this point, but the scaffolding VS puts in place makes it very simple to get started and customize as appropriate. Some tutorials I found particularly instructive are:
I’ve used Entity Framework quite a bit in the past, but have not had an opportunity to use the Code-First approach extensively. The second link above was also very instructive in this topic. Something I think would be particularly useful is Code-First Migrations, which allows you to update your data model as you develop without having to drop your existing database. Migrations generates methods to step your existing database up to the new model or down to the previous one. In the past I’ve found modifying my data model once there is an actual production database extremely tedious. Migrations should help greatly. I was disappointed that a command-line interface must be used to make use of migrations (with no Intellisense-like auto completion), since I’m sure it will take me a while to remember the correct steps and syntax. But revisiting the sites I mentioned earlier should make it simple enough.
I was also pretty new to the use of OAuth authentication. The following link made it very easy to add OAuth to my test app:
Having heard stories of Azure deployment being difficult in the past, I’ve been wary of it until now, but it looks like more recently Microsoft has done a lot to make the process as simple as possible. I was impressed with how easy it was to move a locally-hosted web site to Azure. Once you have your Azure account set up, it took almost no time at all to deploy to Azure. Moving a database to Azure SQL Database was equally as simple. I’m currently using my free trial on Azure, so I haven’t had to deal with monitoring real usage and being cautious to limit my charges, but I’ve heard this has been improved as well, and developers no longer seem to be incurring unreasonable charges accidentally. The following links were great for getting started:
Overall, I feel much more comfortable tackling the creation of a web application hosted in Azure. Microsoft has done an excellent job easing developers into these technologies, and they look like great solutions for well-architected, highly-scalable web solutions.