Build asp.net MVC applications FAST with MVCExtensions v0.4
Introduction
Today I finished v0.4 of my MVCExtensions library and I pushed the sourcecode to github.
I also included a very simple tasklist, in order to show you on how to get started using this library. You can also see (slightly outdated) example code in this blog post...
You can see a demo of the tasklist app running here. (Try entering a task without a name, or with a name that has more then 256 chars to see the custom strings in action).
You can download the full sourcecode here.
Update
I now made a screencast as well. it is available here.
What is MvcExtensions ?
It is a library I wrote that takes out the burden of setting up a new MVC app each time. It was developed in order to be able to deliver apps faster to my customers...
In order to set it up, you need to create a class that defines where your domain model objects are, and register the module in global.asax. That's it !!!
The library auto-wires asp.net mvc with castle.windsor IOC, @jbogard's Automapper, @jagregory's FluentNHibernate ORM, @Loudej's Spark viewengine, @JeremySkinner's MvcContrib and some custom extensions. The idea is that the library takes all the hassle out of the setup of an asp.net MVC app and their dependencies...
It should also be pretty well structured using Services/Generic repository, Model-View-Viewmodels, ...
It also has a few predefined string classes with fixed length/null-& regex checkers for validation as well, controller action links that are defined in the controller instead of in the view, ...
This should allow you to write very clean controllers as well with custom automappers injected into the controller.
It also contains 3 spark extensions for the spark view engine in order to render actionlinks without much hassle.
Some Aubergine BDD as well
Next to this it also contains a @tojans Aubergine BDD project with specs and a context.
This is the specs file:
Define a group of tasks
using Tasks.Specs.TaskContext
from Tasks.Specs.DLL
Story manipulate tasks
Is about a group of tasks
As a person
I want to log my tasks
So that I do not forget anything and get my priorities straight
Given the following tasks exist
+---------------------------+------------------------+--------+
| name | description | status |
+---------------------------+------------------------+--------+
| Do the dishes | Be carefull | Todo |
| Update Aubergine project | procrastination FTW !! | Todo |
| Order stamps | 20 pieces | Done |
+---------------------------+------------------------+--------+
Scenario Add a new task
When I add the following task
+---------------------------+------------------------+--------+
| name | description | status |
+---------------------------+------------------------+--------+
| Feed the fishes | Be carefull | Todo |
+---------------------------+------------------------+--------+
Then the tasklist should contain the following tasks
+---------------------------+------------------------+--------+
| name | description | status |
+---------------------------+------------------------+--------+
| Do the dishes | Be carefull | Todo |
| Update Aubergine project | procrastination FTW !! | Todo |
| Order stamps | 20 pieces | Done |
| Feed the fishes | Be carefull | Todo |
+---------------------------+------------------------+--------+
Scenario Switch the task status from "Todo"
When I switch the status of the task "Do the dishes"
Then the tasklist should contain the following tasks
+---------------------------+------------------------+--------+
| name | description | status |
+---------------------------+------------------------+--------+
| Do the dishes | Be carefull | Done |
| Update Aubergine project | procrastination FTW !! | Todo |
| Order stamps | 20 pieces | Done |
+---------------------------+------------------------+--------+
Scenario Switch the task status from "Done"
When I switch the status of the task "Order stamps"
Then the tasklist should contain the following tasks
+---------------------------+------------------------+--------+
| name | description | status |
+---------------------------+------------------------+--------+
| Do the dishes | Be carefull | Todo |
| Update Aubergine project | procrastination FTW !! | Todo |
| Order stamps | 20 pieces | Todo |
+---------------------------+------------------------+--------+
Scenario Delete a task
When I delete the task "Update Aubergine project"
Then the tasklist should contain the following tasks
+---------------------------+------------------------+--------+
| name | description | status |
+---------------------------+------------------------+--------+
| Do the dishes | Be carefull | Todo |
| Order stamps | 20 pieces | Done |
+---------------------------+------------------------+--------+
The specs project generates and shows this report whenever it gets built (unless you introduce a bug).
What should I do with it ?
Well, I would suggest you to check it out, and try to create a small demo app using the mvcextensions lib.
You can download all the required binaries from a single zip here.
I will probably create a walkthrough and/or screencast later on how to do this, unless somebody beats me to it... In case you would like me to show you a demo, do let me know what kind of app you would like to see.
Do not forget that it should be relatively limited on the functionality side in order to implement it in a short demo...
Opinions are appreciated !!
And as always : enjoy !!!