Wednesday, August 15, 2007
Since the original release of Minima, I've added a ton of new features to my own blog (which ran on the original Minima). That plus the release of the .NET Framework 3.5 Beta 2, which includes LINQ, has prompted me to work further on the public release of Minima. Thus, the creation of the Minima .NET 3.5 Blog Engine. This is major upgrade to Minima. Here are some of the new features...
Though I love LLBLGen Pro (the worlds only enterprise-class O/R mapper and database abstractor), I thought it would be tremendously beneficial to build the new version of Minima on something that many more people would be able to appreciate. Thus, I rewrote all data access components to use LINQ instead of LLBLGen Pro. In the Minima .NET 3.5 Blog Engine, there is no LLBLGen Pro left over and thus you do not need the LLBLGen Pro assemblies.
If you are new to LINQ, then the Minima .NET 3.5 Blog Engine is something you may want to checkout.
Windows Live Writer Support (with RSD Support)
The previous version of Minima didn't have any supported blog client. That was left as a training exercise to those using Minima as a training tool. It did however have an extensive WCF interface that allowed simple web-service interaction with Minima. However, since the release of Windows Live Writer (WLW) Beta 2, the need for a WCF interface and the need to write your own blog client is gone. With this release of Minima, you simply setup your blog , point WLW at it and it will detect everything for you via the provided rsd.xml and wlwmanifest.xml files.
As previously stated, the Minima .NET 2.0 Blog Engine had a WCF interface, but this new release doesn't. In it's place is the XML-RPC based Metaweblog API to allow for seamless interaction by WLW.
Simplified File Structure
The file structure of Minima has been greatly simplified and the number of files in the actual website is very minimal now. If you recall, the entire idea behind Minima was that it is very minimalistic. This doesn't mean it doesn't have many features, but it rather means that everything is organized in such a way that makes it look minimalistic.
SQL Server-based HttpHandler Management
A few weeks ago I published a simplified version of the universal HttpHandlerFactory technique, which relies on SQL Server instead of XML configuration files for HttpHandler management. Under this model you can simply go to the HttpHandler table and put in an HttpHandler, the text used to match against a URL, and a matching type ("Contains", "EndsWith", "StartsWith", or "Default"). So, if you want to move your API from /xml-rpc/ to /962c8b59-97dc-490b-a1d1-09b55e47455b/, just go into the table and paste in that GUID over the text XML-RPC and you're done (you will probably have to kill the cache as well since Minima caches HttpHandler mappings-- just open and save the web.config file.) Using this same HttpHandler table you can change the comment moderation endpoint (which uses the MinimaCommentHttpHandler).
Google Sitemap Creator
Minima now allows you to create a Google Sitemap simply by using the MinimaSiteMapHttpHandler registered in the HttpHandler SQL Server table. By default it's registered to anything ending with "sitemap.xml", but by changing the path in the HttpHandler table you can instantaneously change the sitemap path.
File Mapping Support
One of the features I found that I really, really needed a few months ago was a way to symbolically link virtual files to physical files. Thus I built a simple system that would allow me to store symbolic links in SQL Server. Initially there is a default "catch all" folder to which all files are naturally mapped. Internally, this is by setting MinimaFileHttpHandler to a certain path in the HttpHandler table; /materials/ by default. For specific files that aren't in that folder, you simply add the mappings in the FileMapping table. Theoretically, you could have multiple links to the same file using this system.
User Rights System
Since there is a public API, there needs to be some type of rights management system. In the Minima .NET 3.5 Blog Engine, rights are done at the system and blog level and you assign rights to blog authors. For example, an author needs the 'R' (retrieve) system right to get a list of blogs on the system (what WLW will try to do when you point it at this release of Minima) and would need the 'C' (create) blog right to post to a particular blog. There are 'C', 'R', 'U', and 'D' rights that can be set in the UserRight table. If it's a blog right, there is a blogId associated with the right, if it's a system right the blogId is null. It's actually a really simple, yet effective rights system. That the entire point of minimalism.
Access Control System (via IP address, UserAgent, and HTTP Referrer)
In a recent blog entry I alluded to an access control system I added to my blog. This access control system allowed me to control access by IP address, UserAgent, or HTTP Referrer and based up on one of those three things I could either write a message to the browser or forward them. So, for example, if I want to block someone trying to download my entire site I can put the following data in the SQL Server 'Access' table: 1, 'I', 10.29.2.100, 'You have been banned', null, true. That is, on BlogId 1, for an IP Address of 10.29.2.100, show a message of 'You have been banned', don't forward them anywhere (that's the null), and enable the rule ('true'). If you want to have them forwarded to another address, just put the destination address in the AccessHttpForward column and the rule is activated immediately.
This is implemented by an HttpModule, so it's going to apply to absolutely every request coming across the system. They won't be able to download anything off your website, not even images or CSS files. Also, this system works on a "first hit" model. That is, the first rule that is hit is the one that is applied.
Tracing via Reflection
This release of Minima also allows you to trace just about anything to SQL Server. The tracing mechanism works by serializing what you give it into XML and then stores that XML in a table. Doing something like this comes in tremendously handy when troubleshooting APIs. Since Minima's TraceManager has a RecordMethodCall method that accepts a params array of Object types, you can send as many parameters as you want to the method and it will serialize them into XML for storage in SQL Server. Some types are obviously no serializable, but you can always send each property of a type to the method instead of sending the entire object.
As with all my web projects, exceptions are e-mailed to the person monitoring the system. With this release of Minima, I added a feature that I've been using for a while: support for Gmail subjects. Usually in Gmail, messages that look a like will be grouped together in the same conversation. This is a tremendously time saving feature for most everything, but not when it comes to exception monitoring (or comment notification). So, when enhanced Gmail subjects are enabled, e-mail subjects are suffixed with a long random number (actually, the time in ticks) so that no two messages are in the same conversation. The same is done for comment notification.
Previous features were fairly basic and included labeling, commenting, and other blog stuff. The biggest feature of the previous release of Minima was its ability to have more than one URL for a blog entry. So, for example, if you accidentally blog as /Blog/2007/08/LINQ-ruels.aspx, you can add another URL mapping to that entry so /Blog/2007/08/LINE-rules.aspx, which would set as the default mapping, goes to the same place. Both are still accessible, but the new default will be the one that shows up at the blog entry's permanent home. The Minima .NET 3.5 Blog Engine retains this feature.
As a Training Tool
As with all my project there is an "As a Training Tool" section in the release notes. This release of Minima can be used to train concepts such as ASP.NET, CSS theming, proper use of global.asax, integrating with Windows Live Writer, framework design guidelines, HttpModules, HttpHandlers, HttpHandlerFactories, LINQ, type organization, proper-SQL Server table design and naming scheme, XML serialization, and XML-RPC.NET usage.
To download the Minima .NET 3.5 Blog Engine simply access the following Subversion repository and download the associated sample SQL Server 2005 database: