I Like ASP.NET Web Pages–Part III
Posted February 23, 2011on:
I am always impressed by PHP based CMS, like Joomla, Drupal, Wrodpress and etc. Nothing from .NET comes close to them.
With the WebMatrix, I want give it a try myself to build a dynamic and extensible site. It is going to have features of
- NuGet Package
Modules are a deployment packages of certain functionality. E.g. Pages, Blog, News, User Management … Modules are deployed as NuGet Packages. Modules can be enable and disable at runtime.
Many CMS have the concept of module (Drupal, XOOPS, DotNetNuke, Orchard…). It is called Component in Joomla.
Module functions are extensible. Modules publish extension points to allow other modules to extend functions.
The concept of Extension points is famous in Eclipse. MEF uses Import and Export. WordPress uses Hooks. Inspired by WordPress, I will use Hooks.
Hooks are a loosely coupled event publication and subscription. From anywhere of the site modules, you can request to run a hook (like fire a event). If any module has added (registered) the hook implementation, it will be invoked. The result of all hooks are chained.
E.g. In the _PageStart, there is a line.
Layout = Site.RunHook("get_layout") as string;
The template module responses to the hook get_layout and return the layout file name.
That’s it. The core mechanism of a dynamic site is that modules request hooks and as well as implement the hooks. Hooks glue all program pieces together.
Put it all together I will create a framework, the Rabbit Framework for WebMatrix.
Name it Rabbit, just because rabbit are small, light, fast, delicate … and this year is the Year of Rabbit.