Jun 17, 2011

MVC 3 : Create a Simple Blog Application Pt. 1

In Part 4, I have covered on how we could create custom dynamic partial view on MVC 3 by using simple javascript.  So on this next tutorial, I'll post on something a bit different from partial view.  This post will cover on how we could create a MVC 3 web application.  At the end of this series of tutorial, we will have a fully working Blog System, which will have login, Posting, Editing, and all basic function of a blog.

This tutorial will be focusing on basic function of Modeling(I'll be using Lightspeed as ORM), Controllers and lastly Razor view engine.  I'll also cover on Repositories pattern, use Ajax and many more.  Subscribe to this blog in order to follow all the tutorial that will be post in near future.

Repository also generally known to MVC 3 programmer as Repository patterns is a technique to manipulate data from our Models.  For example, when we have Models that have several type of attributes (id,name,location) we might need to build a repository that will list all data, list single data, list all data but with only one or some attribute(s) and etc.

When we codes this class, it's is known as Repositories Pattern in MVC term.  In this tutorial, I'll explain on how we could use Repositories to simplify our code and reuse it many times without needing to write it every time. 

In this tutorial, I'll start fresh by starting a new project.  This is the project that we will be using for all my upcoming tutorials.  So please use follow the steps carefully.  I'll assume that you have understand the basic fundamental of using MVC framework to follow this guide.  For general information, my development will be using:
  1. .NET version 4
  2. MVC 3
  3. Razor View as viewing engine
  4. Visual Studio 2010 as IDE.

Let's Start A New Fresh MVC 3 Project...

imageFirst step is to create a project.  In order to create the project, we will choose ASP.NET MVC 3 Web Application.  Our tutorial focus is to create a new blog system with MVC 3.
So I'll name my project with NegativeZero and automatically my Solution name will also inherit my project name which is Negative Zero.  If you would like to use other name as you project name, you are mostly welcome.  But you have to be extra careful with my declaration later.

And for the template, I'll just select the Internet Application template.  We will be using Razor as our view engine as this engine is flexible and great to try on.  Don't forget to check Use HTML5 semantic markup when setting the project template.  I prefer to check this one just in case we would like to use HTML5 feature later on for this project.  For unit test? I'll just leave it blank cause we still can create Unit Test when needed one later.

After finish setting up our new project on Visual Studio 2010, our Solution Explorer will have something similar to this one that I have here.  Basically, this template is enough for us to start running our first MVC 3 web application without the need for us to adjust and code anything.  By default, visual studio will run the application on your default browser when F5 is pressed if there is no error on our code during program compile process.  So this is is the default view for our fresh MVC 3 project at this moment.
Next tutorial will cover on create a fresh model by using LightSpeed.  How to setup Lightspeed to use with MVC 3.  Please leave comments and don't forget to like this post if you think it is useful to you.

Other blog that I use as my revision:

Blogger Labels: Part,custom,tutorial,series,Blog,System,Razor,engine,Repositories,Ajax,Subscribe,Repository,technique,data,example,location,Pattern,code,times,steps,framework,development,version,View,Visual,Studio,Start,Fresh,Project,Application,NegativeZero,Solution,Negative,Zero,declaration,template,Internet,unit,Test,Explorer,error,moment,setup,comments,revision,Scaffold,LINQ,Controllers,codes,tutorials

Thank you for your unbelievable support on Negative Zero - Permission to read and write blog for nearly 4 years. Don't forget to like Negative Zero on Facebook.
Blogirific.com Blog Directory

Post(s) you might like to read :



Post a Comment