svallory / MiniMvc

A Pluggable .Net MVC Framework which will allow you to easily migrate your app to the real .Net MVC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Careful: It's still under development

About the MiniMvc Framework

Actually, the term "mini" isn't accurate. It should be micro, nano or even yocto! But I like the sound of MiniMvc. To give you an idea of how small it is, the project has 7 code files (I like it, seven is the number of perfection), and about 10 classes. You are probably wondering: it can't be good if it has only 10 classes! And, probably the question bugging you more is...

Why the hell would someone create this?

Quick answer: To gradually migrate an old, big project, either in Web Forms or Web Site structure, into the new shiny MVC 3 framework. With MiniMvc you can add some features to your application while keeping the old code running. So, all the new code you write goes into the right place and you can piece by piece move pages into controllers and views.

How does this little thing help with that?

Basically, it adds the following capabilities to your application:

  • URL Routing to route requests to controller methods
  • A base Controller class to easy up some repetitive work
  • Razor views to render your output (Thanks to RazorEngine)

Which is actually most of what MVC is all about. The models aren't covered just so you can use wherever you want.

Interested? Let's see how the process works...

1. Configuration

  1. Add a references to the MiniMvc.dll and RazorEngine.dll

  2. Configure the Razor views on your Web.config

  3. Instantiate the MiniMvc inside your Global.asax file like this

    VB

     Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
         MiniMvcSystem.GetInstance(System.Reflection.[Assembly].GetExecutingAssembly(), "~/Views")
     End Sub
    

    C#

     void Application_Start(Object sender, EventArgs e)
     {
         MiniMvcSystem.GetInstance(System.Reflection.Assembly.GetExecutingAssembly(), "~/Views");
     }
    

    Note: the second parameter, if you didn't guess it yet, is your Views folder :)

  4. Create Controllers and Views folders. The Controllers folders can be anywhere, e.g. ~/App_Code/Controllers (if your project is of type Web Site, you have to put the folder somewhere inside App_Code. If you used the above config, you have to put the Views folder at the root of your site / application.

About

A Pluggable .Net MVC Framework which will allow you to easily migrate your app to the real .Net MVC


Languages

Language:C# 100.0%