Archive for category MVC

My own ASP.Net MVP Framework

So, I did it! I finally did it!

I wanted to publish my ideas for a framework, and I did. You can find it on CodePlex at

Go have a look. I really want to know what you think.

Read the rest of this entry »

, ,


ASP.Net MVC Corollary – What to do?

Dude! I got quoted! And by none other than Rob Conery of SubSonic fame.

It seems like my last post caused quite an unexpected stir. Thanks to both Rob and Scott for taking the time to answer me. I really appreciate it.
Read the rest of this entry »

, , ,

No Comments

Does the ASP.Net MVC Framework Frustrate You?

Silverlight, ASP.Net Ajax, LINQ, Astoria, ASP.Net MVC – there’s just tons of stuff coming out of Microsoft. And that’s not to mention the stuff people have seemingly forgotten about – ASP.Net Futures with IronPython (AWOL), Patterns and Practices Web Client Software Factory, WPF, WF, WCF and CardSpaces. Now the trend seems to be functional programming languages, especially with F#.

There’s just a bit too much for me.

What I really need is guidance. My customers don’t ask me what to they should use in 6 months; they ask me how to use what already exists. They don’t want “cool”; they want stability and consistency. And while the ball keeps moving, we can’t grab it.
Read the rest of this entry »

, , ,


ASP.Net MVC Framework leads you to extension method heaven

The first pre-release of new ASP.Net MVC (ahem, Ruby-on-Rails for .Net) framework has just been made public.

I find it really exciting that Scott Guthrie and his team are listening to what the people want. Webforms is really quite heavy, especially in comparison to Ruby on Rails, so by offering new frameworks Microsoft will gain new developers. And new developers equals more servers, so it’s a good business model, methinks.

A major plus for me is seeing how the Framework shows off the new C# 3.0 features. I love Python and Ruby, but with no support yet for Visual Studio, it’s not easy to use them. Until now, the expressiveness of Python and Ruby have been missing from C# – it grew up from Java after all – but C# 3.0 is now moving towards that expressiveness too. With XAML and C#, things have really changed for developers over the past 5 or so years.

For example, check out this post from Rob Conery. He demonstrates an extension method which allows you to create a list of attributes as a string. You just call “ToAttributeList()” on any object, and you get a string back like “field1=”0″ field2=”1″”.

I can already think of loads of places where I would like to use that. There’s already a “ToDictionary()” method in the .Net 3.5 Framework, which can be used to create a dictionary from a list of objects, using a field as the key, but I can create a dictionary directly using the property names as keys, with the objects as values.

public static Dictionary<string, object> ToPropertyHash(this object item)
  var props = from property in item.GetType().GetProperties()
              select new {Name=property.Name, Value=property.GetValue(item, null)};

var dict = new Dictionary<string, object>();
foreach(var prop in props)
dict.Add(prop.Name, prop.Value);

return dict;

Here’s testing code which demonstrates what you get.

var myObject = new { Name = “Frank”, Age = 5 };
var dict = myObject.ToPropertyHash();
CollectionAssert.Contains(dict.Keys, “Name”);
CollectionAssert.Contains(dict.Keys, “Age”);
Assert.AreEqual(dict[“Name”], “Frank”);
Assert.AreEqual(dict[“Age”], 5);

Maybe that’s not so interesting for you, but I am developing Windows Workflow Foundation apps, and a workflow instance always requires you to build a new dictionary with the names of the properties as keys. This could be very, very helpful to cut down on code for that.

Instead of …

Dictionary<string, object> args = new Dictionary<string, object>();
args.Add(“Name”, “Richard Bushnell”);
args.Add(“Age”, 32);
args.Add(“NoOfKids”, 5);

… I use:

var args = new { Name = “Richard Bushnell”, Age = 32, NoOfKids = 5 }.ToPropertyHash();

What I cannot understand yet, is why Microsoft has to copy Ruby On Rails? Don’t get me wrong, I love Rails. But in some places it just doesn’t suit development. developers already have their ways of working, and have bought controls, etc. Why force them to not use them anymore, if they just want to tidy up their code with a new MVC model? Wouldn’t it be best for everyone if they developed another kind of framework? The focus could be on testing, as with MVC, but more directed towards developers who already use WinForms and WebForms.

Microsoft can develop independently. Take LINQ, for example. The .Net team could have simply provided list comprehensions as implemented in Python, but instead, they came up with a totally new model which no other development framework has ever had. And while XAML is similar to the old Delphi DFM files, it’s still taken some good leaps forward. I don’t see that yet with the ASP.Net MVC Framework. They’re still playing catch-up with Rails.

In general though, I’m really excited to watch it developing.