I wrote some custom code to convert the community server blog entries to a blogml version so that I could import it into blogengine.net. I considered using the blogml assembly to create the code, but decided to hand-code it instead.
The way to use this is to create a blog, write one post, export it out (settings->export), and then hand-insert the categories and post sections into that exported file, then re-import it back. I decided to skip comments to make things easier.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.IO; namespace blogconverter { class Program { static SqlDataReader Execute(string query) { SqlCommand command = GetConnection().CreateCommand(); command.CommandText = query; SqlDataReader reader = command.ExecuteReader(); return reader; } static SqlConnection GetConnection() { SqlConnection connection = new SqlConnection(@"Data Source=HOMELAPTOP\SQLEXPRESS;Database=BCCommunityServer;Integrated Security=SSPI;"); connection.Open(); return connection; } static void Main(string[] args) { using (StreamWriter writer = File.CreateText(@"c:\data\website\posts.xml")) { string categories = GetCategories(); string posts = GetPosts(); writer.WriteLine(categories); writer.WriteLine(posts); } } static Dictionary _CategoryLookup = new Dictionary(); static string GetCategories() { StringBuilder b = new StringBuilder(); b.Append(""); SqlDataReader reader = Execute(QueryCategory); while (reader.Read()) { int categoryId = (int) reader.GetValue(0); string name = (string) reader.GetValue(1); Guid id = Guid.NewGuid(); _CategoryLookup.Add(categoryId, id); b.Append(String.Format( @"
So, what do you think ?