BlogEngine.NET runs entirely on XML files located in the App_Data folder. That makes it truly plug ‘n play, but not everybody likes XML files. We’ve had a lot of requests for SQL Server and MySql providers, so now we finally released an open provider model.

Now it’s possible to write your own providers in an extremely easy and intuitive way. There are two steps involved. First of all you need to write the provider and secondly you have to add it to the web.config.

Writing providers

A provider is 1 single class that inherits from BlogProvider and implements 10 methods. These methods inserts, updates, deletes and retrieves posts, pages and categories. Here are the abstract methods that must be implemented on the custom provider:

// Post
public abstract Post SelectPost(Guid id);
public abstract void InsertPost(Post post);
public abstract void UpdatePost(Post post);
public abstract void DeletePost(Post post);

// Page
public abstract Page SelectPage(Guid id);
public abstract void InsertPage(Page page);
public abstract void UpdatePage(Page page);
public abstract void DeletePage(Page page);

// Category
public abstract CategoryDictionary LoadCategories();
public abstract void SaveCategories(CategoryDictionary categories);

When they are implemented you can fill them with SQL statements, stored procedures or whatever data store mechanisms you like. You can look at the default XmlBlogProvider for inspiration.

Changing web.config

The BlogEngine configuration section in web.config needs to be updated to make the custom provider work. This is the section with the default XML provider set up. Just add your provider and set it as default in the defaultProvider attribute.

< BlogEngine >
 < blogProvider defaultProvider ="XmlBlogProvider" >
  < providers >
   < add name ="XmlBlogProvider" type ="DotNetSlave.BlogEngine.BusinessLogic.XmlBlogProvider" />
  </ providers >
 </ blogProvider >
</ BlogEngine >

When both the provider is written and web.config changed, it will work just like that. If you write a provider and wish to share it, please let me know and I will send a link your way.

Get the latest bits with the new provider model at CodePlex.

Today I finally released the entire source code on CodePlex. From there you can submit bugs and download the latest builds.

This also marks the point where BlogEngine is going open source. You can check out the work in progress and submit bugs and feature requests. The team of developers working on BlogEngine is about to be gathered - a team that will make releases on a regular basis. This hopefully ensures that BlogEngine will keep the pace in the development of new features. If you have something to contribute or want to be part of the team, send me an e-mail.