by
Tom
20. May 2010 14:21
Introduction
As you might allready know, I am maintaining a .Net CF application for one of my customers. Unfortunately, the design of the app is a total disaster, and maintaining it is actually a living hell. Fortunately however, my client decided to order a complete rewrite, which I started today. This post will not contain the sourcecode (as it is a proprietary app), but rather explain the guts of the underlying architecture and some info about the design decisions used.
Maybe I will release some of the reusable components in the future under open source, but I am not quite sure yet...
Yet another framework ?
Actually, yes !! My main concern about this app framework is keeping it lightweight, flexible, ultraportable and easy to use. By ultraportable I mean that the app should both run on the default .Net, as well as on the Compact Framework, without recompilation.
Since no framework known to me meets my criteria, I decided to get started on yet another framework.
The main design decisions are heavily based on my previous experiences with MvcExtensions, my other framework, as well as a very inspiring and well-know lecture by Rob Eisenberg: "Build your own MVVM framework".
More...
by
Tom
20. April 2010 15:02
Introduction
For one of my customers I needed to have some kind of versioning for a whole bunch of entities on my database. Since I use my very own MvcExtensions framework, I wanted to include a functionality which would automatically filter all entities based on this interface :
public interface IVersionAware
{
string Version { get; set; }
}
In short, I only want to get the entities of the current version through my repository. This interface would then automaticly imply that all data could be filtered by setting a version filter.
I took me quite some time, but spending a weekend at the Dutch coast cleared my mind a bit, and after the weekend I managed to get it working...

More...
by
Tom
12. April 2010 07:28
It has been a while, but I finally managed to push a major upgrade to MvcExtensions; this is the change list:
* Upgraded spark for MVC RC2
+ Extra string operators for MyText
+ Added abstract model for Joe Celko's NestedSet
+ Added Dynamic SQL (text sorts etc)
+ Added HttpContextBoundObject
* Improved & extended FluentNhibernate/Database
+ Added Fluentnhibernate TextAlteration for mytext field length in db
* Improved SetCultureLanguageAttribute
+ Added a class SetCultureHelper for temporary changing language
+ Added IEnumerableHelper extensions for Page & Paging
+ Added helper for building jQuery jqGrid models
* Bugfixed MyTextModelBinder
* Improved MvcExtensionsModule
This application framework has allready been used for 2 custom customer applications, and I have to say that it made my development quite successfull.
I have to admit that the documentation is still lacking a lot, but there is a sample project included.
As always, you can download the code here :
http://github.com/ToJans/MVCExtensions
by
Tom
29. January 2010 20:16
Introduction
This is my first screencast for my MVCExtensions project, it shows you how to get started and build a simple tasklist.
PS: This is the direct link to the powerpoint used:
http://docs.google.com/present/view?id=dgt3mk3c_6fmhrd9c5
Some background info
This was my first screencast, and it took me about 7 attempts to finally get it to a point where it was more or less acceptable. For my sixth and seventh attempt I finally found some good screencap software : BBFlashback Express.
Anyway, this has been an interesting experience, and now enjoy mvcextensions !!!
More...
by
Tom
20. January 2010 19:28
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.
More...
Tags:
.net, asp.net mvc, aubergine, bdd, c#, codeproject, commercial, git, jquery, linq, open source, mvcextensions
CodeProject | Development | News
by
Tom
18. January 2010 15:51
Hi there,
I am going to give you a quick teaser on how to setup a full asp.net mvc application with database & all the rest using my soon-to-be-updated MVCExtensions library.
More...
by
Tom
7. December 2009 20:26
You can download the full source here using (msys)git:
http://github.com/ToJans/MVCExtensions
// The quest for perfect asp.net MVC code - v0.3
//
// For a while I have been looking for the perfect ASP.Net MVC code.
// This is the cleanest code I have been able to write.
// I would like to challenge everyone to do better !!!
//
// By this I mean creating a better controller/views if possible codewise.
// The focus is not on the layout stuff, but having it might be a plus.
//
// The scope : a very rudimentary Task list (KISS)
//
// You can download the full source here using (msys)git:
// http://github.com/ToJans/MVCExtensions
//
// You will see it is very easy to alter, just fetch it with git and press F5
//
// Please do let me know what you think about my approach as well,
// and whether you could do better: ToJans@twitter
// Send this link to as much fellow coders as possible, so we can see lots of alternatives
//
// PS: you can also leave a comment @ my website (look at my twitter account for the url)
//
// Edit: this is my third version, and I am still looking for improvements
//
// Some noteworthy facts :
// - In the MVCapp, there only DLL directly referenced is the ViewModel DLL,
// so the views do NOT reference the controllers anywhere
// - The controller contains only logic & domain model objects => VERY CLEAN Controller
// - The resulting controller action model is mapped to the ViewModel using
// IMapper.Map<source,ViewModel>(s,vm)
// - The viewmodel should include everything that should be visible on the screen, so not only
// data but also the actionlinks one can use
// - The actionlinks for the viewpages are defined in the IMapper, and automaticly passed on to
// the view => you can see/alter the program flow in the mapping definitions
// - Stubbing the controller should be a piece of cake using this code, so you could use this
// design to easily develop application mockups that are ready to be implemented once the client
// approves, so first build your viewmodels and views, show it to the client, and upon agreement
// start development on the controller.... In fact I am going to test this method on my next project
//
// Kind regards,
// Tom Janssens
More...
by
Tom
3. December 2009 19:41
Edit:
Please note that the source has changed a lot lately, and that I now use a proper viewmodel instead of domain objects, so all hardlinked references to the domain objects & controllers in the MVC project have disappeared. This also automaticly made my ugly domain object extension methods to get the controller action links completely redundant.
You can see the latest version on github.
The next thing to do is split up the mapping bit using a proper mapping tool (f.e. AutoMapper).
Edit 2:
New article here : The Quest for the perfect ASP.Net MVC code : v0.3
// For a while I have been looking for the perfect ASP.Net MVC code.
// This is the cleanest code I have been able to write.
// I would like to challenge everyone to do better !!!
//
// By this I mean creating a better controller/views if possible codewise.
// The focus is not on the layout stuff, but having it might be a plus.
//
// The scope : a very rudimentary Task list (KISS)
//
// Some more info about my approach :
// It uses view models which contain both data and ActionLink references
// (like ICommand in WPF M-V-VM )
//
// You can download the full source here :
// http://github.com/ToJans/MVCExtensions/tree/master/src/
//
// You will see it is very easy to alter, just download it and press F5
//
// Please do let me know what you think about my approach as well,
// and whether you could do better: ToJans@twitter
// Send this link to as much fellow coders as possible, so we can see lots of alternatives
//
// PS: you can also leave a comment @ my website (look at my twitter account)
//
// --------------------------------------------------------------------------------
// Controller :
// --------------------------------------------------------------------------------
namespace Tasks.Core.Controllers
{
public class TaskController : Controller
{
// for the sake of the demo we do not use DI
// but just a static class instance here with a fake repo
static IRepository<Task> rTask = rTask ?? new FakeRepository<Task>(null);
public ActionResult Index()
{
return View(new VMIndex()
{
AllTasks = rTask.Find.OrderBy(o => o.Name),
AL_AddTask = this.ActionLink("Add new task",c=>c.AddNewTask(null,null))
});
}
public ActionResult AddNewTask(string name,string description)
{
var t = new Task() { Description = description, Name = name };
rTask.SaveOrUpdate(t);
return this.RedirectToAction(c => c.Index());
}
public ActionResult Done(int id)
{
var t = rTask.GetById(id);
t.Done = !t.Done;
rTask.SaveOrUpdate(t);
return this.RedirectToAction(c=>c.Index());
}
public ActionResult Edit(int id)
{
var t = rTask.GetById(id);
return View(new VMEdit()
{
Name = t.Name,
Description = t.Description,
AL_PostEdit = this.ActionLink("Save changes",c=>c.PostEdit(t.Id,null,null)),
AL_CancelEdit = this.ActionLink("Cancel changes",c=>c.Index())
});
}
public ActionResult PostEdit(int id,string name,string description)
{
var t = rTask.GetById(id);
t.Name = name;
t.Description = description;
rTask.SaveOrUpdate(t);
return this.RedirectToAction(c => c.Index());
}
public ActionResult Delete(int id)
{
rTask.Delete(rTask.GetById(id));
return this.RedirectToAction(c => c.Index());
}
}
}
// --------------------------------------------------------------------------------
// Index.Spark
// --------------------------------------------------------------------------------
<viewdata model="Tasks.Core.ViewModel.Tasks.VMIndex" />
<content name="Title">
Index
</content>
<content name="Main">
<h1>Task list</h1>
<if condition="Model.AllTasks.Count()==0">
No tasks yet.
</if>
<else>
<table>
<tr>
<td>Name</td>
<td>Name</td>
<td>Status</td>
<td>Edit</td>
<td>Delete</td>
</tr>
<tr each="var t in Model.AllTasks">
<td>${t.Name}</td>
<td>${t.Description}</td>
<td><alink a="t.AL_Status()" /></td>
<td><alink a="t.AL_Edit()" /> </td>
<td><alink a="t.AL_Delete()" /> </td>
</tr>
</table>
</else>
<hr />
<h3>Add a new task</h3>
<aform a="Model.AL_AddTask">
<label for="Name">Name :</label><br />
<input type="text" name="Name" /><br />
<label for="Description">Description:</label><br />
<textarea cols="20" rows="2" name="Description" ></textarea><br />
</aform>
</content>
// --------------------------------------------------------------------------------
// Edit.Spark
// --------------------------------------------------------------------------------
<viewdata model="Tasks.Core.ViewModel.Tasks.VMEdit" />
<content name="Title">
Edit
</content>
<content name="Main">
<h3>Edit this task</h3>
<aform a="Model.AL_PostEdit">
<label for="Name">Name :</label><br/>
<input type="text" value="${Model.Name}" name="Name" /><br/>
<label for="Description">Description:</label><br/>
<textarea cols="20" rows="2" name="Description" >${Model.Description}</textarea><br />
</aform>
<alink a="Model.AL_CancelEdit" />
</content>
