Thursday, October 24, 2013

Book Review: Exam Ref 70-486: Developing ASP.NET MVC 4 Web Applications

I have passed the Microsoft Exam 70-486: Developing ASP.NET MVC 4 Web Applications on last Saturday. My main study aid is the Exam Reference book by Microsoft Press, Exam Ref: 70-486 Developing ASP.NET MVC 4 Web Applications (hereafter, 70-486 Book). Hence, I want to write this little book review as a guide to those who want to pursue the same exam.

For those who regularly renew their Microsoft Certification, you may notice that the 70-486 book is relatively thin (about 380 pages) and one-third the price (around $26 on online book store like Amazon), when you compare it wit other exam preparation books by Microsoft Press.

So what's the catch?

Most exam preparation books usually teach you about the technologies and how to use it. They usually provide some step-by-step training on how to accomplish certain tasks, while covering most of the topics around the exam. Most the time, the exam prep books try to teach you a certain technology from beginner level, which is great if you are new to the technology.

This is not the case for the 70-486 Book. The content of the 70-486 Book is mainly focus on the different Objectives for the exam. It provides certain high-level overview and advice on the various topics around the objectives, but little details on the low-level development and implementation. It assumes the reader already have some experience with ASP.NET MVC 4, and that the reader is studying this book mainly for the exam preparation.

Without a doubt, the 70-486 book does cover all objectives and topic. Yet outside of the scope of exam preparation this book is not very useful. It gives me a feeling that Microsoft Press simply wants to put up an exam prep book for the sake of publishing an exam prep book for every exam.

For those who are preparing for the 70-486 exam, you may want to read it.
For those who simply want to learn ASP.NET MVC 4, you better look elsewhere, such as the Professional ASP.NET MVC 4 by Wrox, which is a much better training guide and it covers so much more.

Winter is coming, and we are entering another exam studying season. Next stop, Exam 70-487: Developing Windows Azure and Web Services. This will lead me to the latest Microsoft Certified Solution Developer (MCSD): Web Applications.
Ironically, I was certified with the old MCSD: .NET around 10 years ago. Since then Microsoft changed the title to Microsoft Certified Professional Developer (MCPD). Now they are reusing the old name, which leads to tons of confusion for a lot of our clients.

P.S. As of this writing, Microsoft just release the new Visual Studio 2013 together with ASP.NET MVC 5 Framework.
Most of the newer projects in my company is still in VS2010 and .NET4, and we still have lots of .NET 2.0/3.5 projects that we need to support.
It's not just that our training cannot catch up with all these new stuffs, all these new certification are already "out-dated" by the time we start studying it.
After all, it makes me wonder whether it's really worth it to get certified.

Git saved the day

On last Wednesday, the firewall server in our company had some fatal error and was down for most of the day. There was no connectivity to and from the outside world to our network.

My core project was working with an enterprise application for a client who hosted their source control repository on the internet. No internet access mean that I could not access the repository.

For those who are using centralized repository (such as RVS, CSV, SourceSafe, TFS, SourceGear Vault, etc), this usually mean that you have to work in offline mode or disconnected mode.

However, my client is using Git system, which is primarily a disconnected distributed source control system. The core concept in Git is that each developer has a local repository on their own machine. Everyone will check-in/check-out files on the local repository. From time to time you sync it with the remote repository, which act as the centralized repository.

With Git, I was able to continue my work without being affected by no external network connectivity. At the end of the day, I was able to finish my tasks, and checked-in all my code to the centralized repository after our firewall server was up-and-running once again.

Git saved the day.

Tuesday, October 8, 2013

Entity Framework 5 Code First to SQL expected .NET 4.5

A few days ago one of my colleague ran into a bit of problem when deploying an ASP.NET web site to a production environment.

The web site was a typical N-Tier architecture, with Entity Framework 5 for .NET 4 with Code First as the Data Access Layer.

Everything worked fine on development environment and test environment. However, once deployed to production server, the first smoke test already showed some unexpected result.


The error read "The specified value is not an instance of type 'Edm.Int32' Parameter name: value."

This is pretty much the worst nightmare for any developer -- a fatal error on deployment to production environment!

The web project's target framework was set to .NET 4. Entity Framework 5 was added via NuGet Package Manager. The error suggested that the database schema did not match with the classes of Data Access Layer. We had checked both the source code and database schema between development and production, and they appeared to be identical.

After a bit of Googling, it turned out that certain functionalities of Entity Framework 5 Code First required .NET 4.5 Framework on the server.

The root cause was that some Code First classes had enum type fields mapped to int type column in some of the DB tables. Enum support for EF only applied to .NET 4.5 core library, and not of the downloadable EF 5 NuGet Package for .NET 4.0.

Both development environment and test environment had .NET 4.5 Framework installed (for other projects), which was missing in the production environment.

After installed .NET Framework 4.5 on the production server, everything worked again.

Apparently, no one, including myself, realized that Entity Framework 5 requires .NET Framework 4.5. EF 5 will work on .NET Framework 4.0, but only support the same set of functionality as EF 4.2

It was a lucky day. The issue resolved without changes in source code or Database schema.

Lesson learned, also some appreciation and a cup of hot coffee. ^.^