Minima - February 2007 "CTP" David Betz Creative Commons Attribution 2.5 License Minima is designed to give developers a minimalistic template for creating a feature rich alternative to Blogger, Wordpress, and other large-scale blogging systems in manner consistent with the technologies and design paradigms of ASP.NET 2.0, XHTML, CSS, ECMAScript, and the Framework Design Guidelines.
Minima is minimalistic in a number of respects. First, does not overload itself with every possible feature in the known universe. Next, it's designed to put extra features as addons in an effort to keep the code somewhat maintainable. Furthermore, the primary way of interacting with Minima is a single facade (a class designed to make interaction with the internal mechanics easier) with very understandable methods. This facade is actually the API exposed as a WCF service. Finally, in this release there is no client application; however, as I say, there is a very easy to use API. It should cover most everything you need. There are also other dimensions to it's minimalism. For example, I put in my mini-exception monitoring system, which notifies me of any exceptions thrown from the website. I could have used the Application Blocks, but I went the more minimal route instead Be clear on this: I'm a complete minimalist and purist. I refuse to have multiple computers, never put two toppings on my ice scream, hate putting anything on my sandwiches, I never use MODs for games, NEVER wear shirts with logos, and never wear more than 2 colors at a time. I hate stuff that gets overly complex. So, I'm a minimalist and this fits me.
There is no management application in this release. I personally use is a small interface I wrote in WPF, which communicates via WCF to the primary server. It was my first real WPF application I wrote and I wrote it before I deeply understood XAML, so I wrote the entire thing using C#. (Those of you who were ASP/PHP masters etfore learning ASP.NET and therefore wrote your first project in pure C# without any markup will know what I mean-- yeah, I did that!) I'm rebuilding it now in mostly XAML with a little code here and there for WCF interaction. Having said all that, you can very easily write your own tool. Even still, I find SQL Server Management Studioss to be one of the best frontends ever made.
The primary way to communicate with Minima is the MinimaFacade class. This class is used internally to get the information for the website. It's also what you should use when writing your own management tool. Looking at the class you will ask yourself "Why in the world isn't this thing static!?". I didn't make it static because I wanted to apply a ServiceContract interface to it thereby giving it exposure as a potential WCF service. The website, however, does use it staticly via the MinimaFacadeCache class. Anyways, the point is, you can easily write your own remote management application using WPF, Winforms, or ASP.NET 2.0 by using WCF. Of course, if you want a secure channel with WCF... that you will have to add on your own as I didn't have an SSL certificate for testing purposes.
There are some things I would definately like to change in future CTPs of Minima. I have an entire list of things I want to either change, fix, or add. More information is forthcoming.
The primary features in Minima are just the ones that I just HAD to have. If I didn't absolutely need the feature, I probably didn't add it (but may in the future!) A few things I needed are: "fake" paths or archives and labels, "fake" URLs for each blog entry, multiple "fake" URLs for each blog entry (some times I have a typo in a title of a blog entry, but by the time I find out the blog entry is already popular--so I can't merely fix it-- I need two URLs to point to the same thing), almost completely database driven (including URL mappings), labels (not folders!, I wanted many labels per blog entry), pure CSS layout and style, pure XHTML structure, and the ability to add, remove, or change a major feature on a whim! Now that last one is very important... if I want to change something, I can. This ability came in handy when I went from blogger to my own engine and in the process lost my automatic technorati ping. That's something I quickly added though.
The DAL was generated using LLBLGen using Self-Servicing template in a two-class scenario. Everything was written in C# 2.0 using ASP.NET 2.0 with a few bits of custom AJAX functionality (I didn't want to use Atlas on this one). All style and layout is CSS as only people who are in desparate need of getting fired use tables for layout. The technorati ping functionality is based on an abridgement of my XML service framework. The RSS feed creation abilities is actual a function of the RSS.NET framework. I would have added Atom, but I've had majors problems with the Atom.NET framework in the past. Finally, the database is SQL Server 2005 (Express in my case), using one stored procedure (which I would like to refactor into LLBLGen).
One of my intentions regarding Minima is to use it as a sample application for .NET training. For example, this is a great way to demonstrate the power and capabilities of HTTPHandlers. It's also a good example of how LLBLGen can be effectively utilized. Furthermore, it also demonstrates how you can quickly and efficiently use WCF to turn a simple facade into a multi-endpoint service. It also demonstrates manual AJAX, CSS themeing, HttpWebRequest, proper use of global.asax, framework design guidelines, and type organization.
For now, just look at the MinimaFacade and everything should become apparant. I'll be posting API samples in the future. See the Samples section below for some examples on using the API.
MinimaFacade facade = new MinimaFacade( ); // The e-mail acts like a primary key, the Id is for mapping to the database // (the integer id in the database is just a good practice) Author author1 = new Author("johnd@home.net"); Author author2 = new Author( ); author2.Name = "Jane Smith"; author2.Email = "janes@gmail.com"; // Author will not be created twice facade.CreateAuthor(author2.Email, author2.Name); Label label1 = new Label( ); label1.Title = "Recipes"; Label label2 = new Label( ); label2.Title = "Baking Tips"; // Create a blog entry with two authors and two labels. Int32 id = facade.CreateNewBlogEntry(1, new Author[] { author1, author2 }, "New Entry", "<p>This is a test!</p>", DateTime.Now, new Label[] { label1, label2 }); Console.WriteLine("Blog entry created."); Console.ReadLine( ); facade.DeleteBlogEntry(id); // Get the latest 3 blog entries from blog 1, but don't return the blog entry content. Blog b = facade.GetBlog(1, 3, false); foreach (BlogEntry be in b.BlogEntries) { foreach (Author a in be.Authors) { Console.WriteLine(a.Email); } } Feed feed = facade.GetFeedUrl(1); BlogEntry blogEntry = facade.GetBlogEntry(84); facade.UpdateBlogEntry(84, "New Entry", "<h4>New Content</h4>"); Int32 labelId = facade.CreateLabel(1, "New Label"); facade.UpdateLabel(labelId, "New Label 2.0"); facade.ApplyLabel(labelId, 84); facade.ApplyLabel(labelId, 84); facade.DeleteLabel(labelId); String rssFeed = facade.PublishRssFeed(1, 5); facade.ApplyAuthor("jdoe@home.net", 84); facade.RemoveAuthor("jdoe@home.net", 84); Int32 commentId = facade.PostNewComment(84, "This is my comment", "John Doe", "jdoe@home.net", DateTime.Now); Comment[] comments = facade.GetComments(66, true);