EcoBlogEngineProvider - Data Provider for BlogEngine.Net - Part 1

by John 5/26/2008 4:02:00 AM

One of the reasons I like Blackfish is that its just so easy to deploy as part of a ASP.Net hosted solution. I had been exploring BlogEngine.Net as an alternative to Community Server and discovered that it comes with a couple of data providers, xml and Sql Server. Since it comes with source code I was able to determine that it should be possible to write my own data provider talking to Blackfish.

I thought it would be a really interesting project to try and get BlogEngine.Net running against Blackfish. This blog post will document how I built the data provider and how you can get  BlogEngine.Net running against it.

The first step was to download the web application  from here. If your just interested in deployment "BlogEngine.NET 1.3 (website)" is sufficient.

I'm running with version 1.3

I'm also a fan of Eco so I decided I would implement my data access layer using that. Once downloaded I got the blog running using the Ms Sql data provider, I was then able to reverse engineer the resulting database into a model.

The resulting model is shown below.

The  source code I will provide is broken down into three projects:-

EcoBlogEngineProvider: This is the BlogEngine data provider.

EcoBlogEngineProvider.MetaData : Rather than create a sql script to generate the Blackfish database, I used the DbxExpress metadata  API to code the database schema creation in Delphi.

Moshine.Eco.Persistance: This assembly contains a component . Since the Eco model is reverse engineered, Eco needs an xml file which maps the model to the database. TResourceMappingProvider is a component I created using a similiar component to one that ships with ECO, this allows me to embed the xml mapping information in the assembly that contains the Eco model.

A word of warning, if you do decide to download the code your going to need the Architect edition of RAD Studio 2007.

Once downloaded you need to build the projects, I have supplied a projectgroup for that. EcoBlogEngineProvider is dependant on BlogEngine.Core, this assembly can be found in the BlogEngine.Web bin directory which comes as part of the BlogEngine.Net download. Your probably going to have to modify the assembly reference in the EcoBlogEngineProvider project before you can build.

Inside the project EcoBlogEngineProvider.MetaData is a file called This is a MSBuild file which allows you to create Blackfish databases populated with the BlogEngine schema.

I have a custom MSBuild task which I run from the IDE which uses the classes inside  EcoBlogEngineProvider.MetaData to create the database schema. It used some code I uploaded to codecentral. You can read my blog post about it here

Assuming that you want to use the CodeGear ASP.Net 2.0 providers for login and membership services, the best way to start the database creation process is to create a new ASP.Net Web Application. Before running the application I would modify the Membership provider settings in web.config to look this 


       <membership defaultProvider="AspNetAdoMembershipProvider">
                <remove name="AspNetAdoMembershipProvider"/>
                <add name="AspNetAdoMembershipProvider"
                     type="Borland.Web.Security.AdoMembershipProvider, Borland.Web.Provider, Version=11.0.5000.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b"


I turned off requiresQuestionAndAnswer and set  minRequiredNonalphanumericCharacters to 0. You can now run ASP.Net configuration from the project manager.

I used the configuration manager to create 2 roles Adminstrator and Editor . I then created a user that was a member of the Adminstrator role.

Following that I closed the project in the IDE and went to the App_Data directory in the project directory. This contains three files which is my Blackfish database and these are


I renamed them to


and saved them in a safe place for later use.

So lets recap. If I downloaded the CodeCentral project to a directory called c:\develop\BlogEngine it would contain the following directories.


If you attempted to build the projectgroup you will notice that a BlogEngine.Web directory is created. This is where you can copy your BlogEngine.Net installation. The final step to deploy your blog is to copy the BlogEngine.Web directory to your hosting service.

If you go into the bin subdirectory of BlogEngine.Web you should find EcoBlogEngineProvider.dll

The next step is to copy your Blackfish database into the App_Data sudirectory of BlogEngine.Web.

You are now going to create the BlogEngine schema in that database. The first thing you need to do is to open  app.config in the EcoBlogEngineProvider.MetaData directory.

You need to modify the database connection string to point to your database in the App_Data directory. For example


<?xml version="1.0" encoding="utf-8" ?>

        <add name="SomeConnectionString" connectionString="database=C:\develop\BlogEngine\BlogEngine.Web\App_Data\BlogEngine.jds;user=SYSDBA;password=masterkey;host=localhost;protocol=TCP;create=false" providerName="Borland.Data.BlackfishSQL.RemoteClient"/>


You can then save the file and rebuild the project.  You can now use the IDE to create the database schema by right clicking on and executing the migration task as can be seen in the picture below.


  Assuming everything is correct this should result in a successful build with 0 errors. If you use the IDE data explorer on that database it should look like the following picture.

  We should now have a empty database for our blog.

The final step before running the Blog web application is to configure web.config to use the Blackfish database, the Eco BlogEngine Provider and the CodeGear ASP.Net Providers.

web.config can be found in c:\develop\blogengine\blogengine.web\web.config 

The relevant parts are as follows:-

1) Configure the application to use the EcoBlogProvider

    <blogProvider defaultProvider="EcoBlogProvider">
        <add name="XmlBlogProvider" type="BlogEngine.Core.Providers.XmlBlogProvider, BlogEngine.Core"/>
        <add name="MSSQLBlogProvider" type="BlogEngine.Core.Providers.MSSQLBlogProvider, BlogEngine.Core"/>

        <add name="EcoBlogProvider" type="Moshine.BlogProvider.TEcoBlogProvider,EcoBlogEngineProvider"/>


2) Add the Blackfish database connection string


    <add name="BlackfishBlogEngine" connectionString="database=|DataDirectory|BlogEngine.jds;user=SYSDBA;password=masterkey;" providerName="Borland.Data.BlackfishSQL.LocalClient"/>

The EcoBlogEngineProvider is using the inprocess LocalClient so you need to specify the provider name as Borland.Data.BlackfishSQL.LocalClient. Its probably best to change the user and password for deployment. The connectionname must be BlackfishBlogEngine because that is the one the data provider is configured to use.

3) Comment out the membership and roleManager sections and replace them with the CodeGear ones from the web.config of the application you used to create the initial Blackfish database.

    <roleManager enabled="true" cacheRolesInCookie="true" defaultProvider="AspNetAdoRoleProvider" createPersistentCookie="true">
            <remove name="AspNetAdoRoleProvider" />
            <add name="AspNetAdoRoleProvider" connectionStringName="BlackfishBlogEngine" applicationName="/" type="Borland.Web.Security.AdoRoleProvider, Borland.Web.Provider, Version=11.0.5000.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b"/>

    <membership defaultProvider="AspNetAdoMembershipProvider">
        <remove name="AspNetAdoMembershipProvider" />
        <add name="AspNetAdoMembershipProvider" type="Borland.Web.Security.AdoMembershipProvider, Borland.Web.Provider, Version=11.0.5000.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b" connectionStringName="BlackfishBlogEngine" enablePasswordRetrieval="false"

4) Unfortunately Blackfish and the CodeGear providers do not run under medium trust so its very important to comment out

    <trust level="High" />

the above section.


Now that the database is in place and the web.config is configured its time to verify that everything is in place. I use the Cassini webserver for this and it can be found in the RAD Studio bin directory. From the RAD Studio command prompt change to the bin directory.

 i.e C:\Program Files\CodeGear\RAD Studio\5.0\bin

You can now run Cassini using this commandline

cassiniwebserver.exe g:\develop\blogengine\blogengine.web 8080

 As soon as Cassini is up and running you can run a browser and browse to this url http://localhost:8080/default.aspx. The web page should look something like this


You should also be able to login using the user you setup at the begining.


In part 2 I aim to talk the code inside the data provider, how I imported my existing blog into BlogEngine and deploying BlogEngine to a hosting provider.


I hope this was useful. I have more than likely glossed over something and probably missed stuff out. Any feedback is welcome.


The source code for the article can be found here.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


BlogEngine.Net | Blackfish | Delphi | ECO


by John 5/22/2008 6:00:00 AM

So I flicked the switch.

Most of the old urls seem to be working and redirecting to the new site. I'm running into a problem with dots being a special character in routing in a few places, so I think I'm going to wait for the next ASP.Net MVC preview rather than fixing it myself :) . More information about the routing changes can be found here.

As I said in my moving post, I switched to BlogEngine.Net running against Blackfish. The redirection of some the urls from my old blog is handled by a web application I developed using ASP.Net MVC and ECO.

I'll be blogging about my data provider in upcoming posts, until then here is a teaser of the Eco BlogEngine model.


I noticed that Google Reader seems to be showing all my old posts as new, I'm not sure why thats happened but I'm sorry. :)


I guess it means it sort of worked, I'm hoping this post appears as well. :)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Providers | Blackfish | ECO | Delphi

Powered by BlogEngine.NET
Theme by Mads Kristensen

About the author

Name of author John Moshakis
I'm a software developer living in Toronto..

E-mail me Send mail


<<  August 2022  >>

View posts in large calendar


    Recent posts

    Recent comments



    Don't show


      The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

      © Copyright 2022

      Sign in