Look Ma... No XML posts in BlogEngine.NET

A few weeks back, I put together an initial Microsoft SQL Server (MSSQL) blog provider for BlogEngine.NET.  It basically allows me to keep all my posts, comments, and stuff in a MSSQL database instead of the standard XML files that BlogEngine.NET uses as a default. 

Why would I want to do this? Well, I not really sure.

It has been a very popular request on the BlogEngine site and I thought that someone from the team should do it and use it so that it doesn't get left behind in the development.  I seemed like the logical person for the job for a number of reasons:

  1. I have SQL Server access with my hosting through WebHost4Life.
  2. My personal/family site is very SQL Server dependant so I'm going to keep my database access for a while.
  3. I'm a team player.

While the bulk of my data is coming from SQL Server, there are still a few pieces of data that are gathered from xml files.  Specifically, the settings, the blog roll (not in use on my site as of today), and referrals. Also, files (images, zip files, etc.) are stored in the App_Data folder.  These items were not a part of the base blog provider class that I implemented to make the SQL Server provider, so they remain as they were for now.

I'm not really sure how I feel about moving all these pieces over either.  I like having files/images where they are and having my settings in an xml files feels right to me.  The others I think should come over eventually which means getting them added to the blog provider or creating a Control provider to handle this storage of information. 

On a side note, I'm ignoring the membership provider for now.  BlogEngine.NET uses implements the membership provider and defaults to use an XML provider.  I could switch this to MSSQL, but I haven't done it yet.  One thing at a time.

The BlogEngine team will need to discuss handling the blog provider further, but I'm guessing that won't happen right away as we are working on getting the new release done and the documentation that goes with it.  In the meantime, I'd really like to hear from those people who are itching to use SQL for data storage what your preferences are for storing this other data and why.  You can let me know in the comments or on the discussions on CodePlex

In the short term, I'll be testing it out on my site for a while before putting together the scripts for installing and using it.  Everything seems to be working great so far as I've been playing with it on a test site for a little while now.  That said, if you see something that isn't working as expected, please let me know.

Comments

5/24/2007 3:46:44 AM #

Mads Kristensen

It's so cool you've written this provider. Many people like to use SQL Server instead of XML for some reason, so now BlogEngine.NET is for them as well. Thumbs up!

Mads Kristensen Denmark |

5/26/2007 1:23:49 AM #

Josh Stodola

I prefer to use a database for many reasons - mainly flexibility.  I don't understand why you even question this.  Databases can be better performing, as well.

I was planning to write a MySQL provider for you guys (open-source baby, gotta love it), but Im pretty strapped for time right now...

Josh Stodola United States |

5/26/2007 2:29:05 AM #

Al Nyveldt

Hi Josh,

I like databases.  Don't get me wrong, but for blogging, XML is fine with me and I believe the XML data gives <u>me</u> more flexibility than SQL Server (and any database).

With the XML provider, I don't have to have hosting with a database (so I could save money), I have less failure points (as my experience with other hosting providers proved that my SQL Server access can go down often), and when I want to change hosting providers, I simply copy my files to the new location and I'm up and running.

There is a speed gain going to SQL to be sure, but for the number of posts I have, it is extremely small.  I'm happy to go with SQL Server, as I said, I have it for other reasons, but these are the reasons why I question it for me.

I'm actually more interested to know about preferences for storing the smaller pieces, like settings, blog roll, and the like.  I guess we could store images in SQL Server as well.  Is this what the community wants or just the ability to put the posts in SQL which is where the big performance gain will be?

Al Nyveldt United States |

6/1/2007 11:42:27 PM #

Josh Stodola

Hi Al, and I am sorry about the delayed response - I forgot where I made that post originally Smile

You make some very valid points, and I believe having the option for XML is probably the best decision you could have made when providing an extensible and flexible blogging engine.  I guess I would have started with a database, though.  As you pointed out, this preference is somewhat dependant on the scale of the blog itself.

My opinions on storing settings and smaller pieces of data and such can go back and forth.  With XML, you can easily modify the settings with just about anything.  With a database, you would probably be forced to create an elegant "control panel" for administrators to update the values.  It would be nice to go either way on this, but it kinda opens a can of worms.  For the smaller chunks of data, I guess XML is probably the best way to go.

Josh Stodola United States |

6/4/2007 6:29:15 AM #

Mike Schinkel

Hi Al:

Glad to see this. I for one HATE Xml blogging engines (from my experience with dasBlog). The XML is too easy to corrupt, you can't ad-hoc query XML like you can SQL, there's not indexing built into XML, and and performance on large XML datasets is horrible.

That said, I'd consider moving to BlogEngine.NET but wonder what you priority is on supporting referrers in SQL? That's a large dataset I'd REALLY like to be able to query.

Mike Schinkel United States |

6/5/2007 2:10:46 PM #

MichaelP

Hi Al, thank you for writing the MSSQLBlogProvider. I wanted to use SQL server for my blogposts as well, alas, there didn't seem to be any schema or scripts available from the BlogEngine.Net main site or discussion groups, so I came up with my own based on the source code.
This works great, there were 2 minor bugs in the code, one in SaveCategories (parameter @id was added twice) and one in UpdateComments (field PostCommentID was not part of the INSERT statement). I would like to compare the schema/script I came up with with yours to make sure I didn't miss any implied relationships.
Greetings from Chalfont, PA!
Michael

MichaelP United States |

Comments are closed
Recent Comments