It’s the end of Coder Foundry Master Class week 3, and I’m beginning to appreciate what you can accomplish with just a few clicks in Visual Studio
Most of this week was dedicated to our blog-building venture. In a nutshell, the project (which is the software behind this blog) requires a couple of database tables for posts and comments, along with views and CRUD logic for interacting with them. Anyone can view posts, but only registered users can add comments, and of course only the Admin can add posts. There’s also a moderator role. It’s nothing that requires software genius to design, but before meeting MVC .NET, I would have expected to spend a considerable amount of time implementing the details of creating the database tables, writing the CRUD logic, generating all the pages for viewing, editing, deleting, and putting in the code to register users and control who can do what. But that didn’t happen. Instead, I discovered the joys of scaffolding and code first development. Basically it works like this:
Now you have a fully functional web app complete with CRUD code. Equally astonishing, the first time you try to access your (still non-existent) database with this program, Entity Framework will create the database tables for you, including foreign key relationships and tables needed for user management.
Depending on your needs, you'll need to do a minor-to-major amount of editing from here to finish your app, but the out-of-the-box functionality is amazing.
As you might imagine, all this auto-magic goodness involves a whole bunch of files. At this point, my simple blog project contains over 500 - I’m so glad I didn’t have to write them all! Of course that does include a bunch of files for my two plugins, TinyMCE and SyntaxHighlighter. That's one reason that a big part of the MVC .Net learning curve is figuring out what to look for where.
That just touches the surface of what crossed my keyboard this week - for example I also experimented with Ajax and JQuery and took a first look at LINQ syntax and lambda expressions. I’m well into information overload, but in order to spare you from the same, I’ll end this blog entry here. Until next week…