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:
- .NET version 4
- MVC 3
- Razor View as viewing engine
- Visual Studio 2010 as IDE.
Let's Start A New Fresh MVC 3 Project...First 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.
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:
- Scaffold your ASP.NET MVC 3 project with the MvcScaffolding package
- ASP.NET MVC, LINQ and Repository Pattern