Another SSDS sample: BlogEngine.NET on SSDS

As a by-product of a project I'm working on, I've got a working version of BlogEngine.NET on SSDS. You can download the provider and other related components from LitwareHR's web site releases section here.

In the package you will find:

  1. The SSDS based BlogProvider
  2. An SSDS based Membership & Role Providers for the web site
  3. Unit tests for all (with about 93% coverage for the provider)
  4. A simple tool for pre-loading the SSDS container with information that BlogEngine need to start

The underlying data access is inspired on LitwareHR's, although I've heavily refactored it. The key ideas remain the same: there's a Repository<T> type, it uses SOAP to access SSDS, etc. but the code is simpler, responsibilities are better balanced and distributed, and I eliminated superfluous code here and there.

The new SSDS BlogProvider also uses patterns & practices Unity application block to wire up dependencies, so you write things like this:

public override Post SelectPost(Guid id)
    Post be_post;
    Entities.Post post;

    using (IRepository<Entities.Post> r_post = RepositoryFactory.Build<Entities.Post>())
       post = r_post.GetById(id);
       if( post == null )
          return null;

    be_post = SSDSPostToBEPost(post);

    return post;

RepositoryFactory.Build<T>() will use Unity's Resolve() method to find the appropriate Repository implementation and all its dependencies configured. Build<T>() body looks approximately like this:

c.RegisterType(typeof(ITenantManager), typeof(DefaultTenantManager));
c.RegisterType<SitkaProxyFactory, SitkaProxyFactory>();
c.RegisterType( typeof(EntityMapper<T>), typeof( GenericMapper<T> ) );
c.RegisterType( typeof(IRepository<T>), typeof( Repository<T> ) );

IRepository<T> r = c.Resolve<IRepository<T>>();
r.TenantId = Constants.BlogEngineContainer;
return r;

I'm still learning about Unity so there might be better ways of implementing what I did, but it works.


Things I've liked about BlogEngine.NET:

  • The provider model. I think it was great design decision that allowed me to write this fairly quickly. I didn't want to look to much into other pieces of BlogEngine.NET, and this provided a clear separation. 
  • The code structure is quite neat. Navigating it was painless and I used the same structure implemented in the XmlBlogProvider.
  • It's a nice app with a lot of functionality and a fun project to work with!

Things that I missed or would have liked to be different:

  • The one thing I missed the most is pre-built unit tests for the provider. 
  • There are some assumptions on the engine and core components about where it runs (particularly ASP.NET) that introduced some issues.
  • I only changed 1 line of code (which was superfluous anyway), and that is this in the Category class in BlogEngine.Core:
internal static string _Folder = System.Web.HttpContext.Current.Server.MapPath(BlogSettings.Instance.StorageLocation);

This prevented me from unit testing my provider in complete isolation. It turns out that the variable wasn't needed anyway, so I commented it out.

  • There are other features in the app that are not abstracted in the provider (or in another replaceable component). For example, file attachments are handled in the Add_Entry.aspx web page. I didn't want to use the file system at all, but I also didn't want to change the code, so I left it as is. There are other parts of the app that have direct dependencies like this.
  • I wasn't sure about the app exception handling architecture, so I opted to do what the other providers seem to be doing: just throw and hope the upper layers handle it :-).


BlogEngine.NET expects some initial data: a user, an admin role and some initial settings. The unit tests will make sure these exist prior to running, and I also created a "Provisioning" console application that populates the container with the needed information. You need to configure all appropriate configuration files with your SSDS credentials.

Finally, because I'm using LitwareHR's data access, you can use the offline proxy to test the system independently from SSDS. So, until you get the SSDS beta account, you can start playing with it.

Feedback is welcome, as usual.

Comments (22)

  1. Clemens says:

    This is great… it will save some time to.

    Yesterday got my beta account for SSDS and the first thing I started with, is porting my blog based on to use SSDS… thanks. For sure feedback will follow 😉

  2. i think that the blogengineis finding its position on the blog engines and the good thing is that it is using new technologies and i think that with fans it will be developed rapidly.

  3. Allez, avouez, vous n’avez rien pig&#233; au titre de ce billet, si ? Alors je vous le refais en clair

  4. Ce moteur, disponible ici en open source sur le site Codeplex , peut être configuré pour tirer avantage

  5. vontlin says:

    I have been learning SSDS and trying to use your code blogengine ssds source code to build my application.

    I spent last 2 days.. couldn’t find a reason…

    I am running into a problem, when i compile and run the application, the code fails here:

    ISitkaSoapService proxy = factory.Build("SitkaProxy");

    –> calls the function:

    public TTypeToBuild Build(string settingsKey)


               string typeName = System.Configuration.ConfigurationSettings.AppSettings[settingsKey];

               TTypeToBuild typeToBuild;

               if (string.IsNullOrEmpty(typeName))


                   return new TDefaultType();




                   typeToBuild = Activator.CreateInstance(Type.GetType(typeName)) as TTypeToBuild;


               return typeToBuild;


    And I get TargetInvocationException at :

    typeToBuild = Activator.CreateInstance(Type.GetType(typeName)) as TTypeToBuild;

    the innerexception shows:

    {"Could not find default endpoint element that references contract ‘SitkaClient.ISitkaSoapService’ in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."}

    i checked all the code/files.. am not sure what i am missing.. any help.. appreciate it..

  6. Eugenio Pace says:

    This looks like a misconfiguration. Check web.config.

  7. Colby Africa says:

    I have been reading about cloud computing quite a bit.&#160; I found that Microsoft is doing something

  8. packboom says:

    I am very much interested on BlogEngine.NET using SSDS.  I’ve downloaded your code but I can’t see source in handling NewMediaObject.  Where to save blob…on SSDS or Windows Azure blobs?  Thanks!

  9. packboom says:

    Hi, it’s me again.  I keep getting this error during provisioning on SSDS:

    The remote server returned an unexpected response: (400) The request contained an invalid Content-Type header value.  The expected value is, "application/x-ssds+xml"..

    It happened at the end of this code on ContainerManager.cs:

                   ISitkaSoapService proxy = new SitkaProxyFactory(tenantManager).BuildProxy();

                   Scope scope = new Scope();

                   scope.AuthorityId = tenantManager.GetAuthorityId( tenantId );

                   scope.ContainerId = tenantManager.GetContainerId( tenantId );

                   containerEntity = proxy.Get(scope);

    Please tell me on how to get with this.  Thanks!

  10. Oes Tsetnoc says:

    I think you have some code that need to replace to avoid mis configuration.

    Oes Tsetnoc

  11. oes tsetnoc says:

    yes..i think their is some  misconfig in your code and you should better fixed can ask this forum to ask for some codes..they are expert.. ( )..for sure they can help you..

  12. Eugenio Pace says:

    This version of SDS is not longer available. So this sample is not applicable any more.

    SDS is now SQL Azure which is compatible with SQL Server. Most probably BlogEngine default provider would "just work".

  13. oes tsetnoc says:

    the code is perfect and i think it is effective

  14. Ed Hardy says:

    Thank you very much for the nice information. It is very useful.

    Ed Hardy

  15. oes tsetnoc says:

    great i use this code and i think it is perfect.

  16. Noah Group says:

    wow..great..this is very useful for some beginners like me.

  17. I am still trying to figure out this code and about to study this. I still need time to see the real purpose of this code, maybe because its quite new to me.

  18. Noah Group says:

    Thanks for sharing this information. .

    Noah Group

  19. Actually your blog looks good…but you must set up it SQL Server DBA.

  20. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me.

  21. <a href="">Magento Northridge</a> says:

    I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.

  22. <a hre="">Web Design Gold Coast </a> says:

    I admire your article.It contains valuable information.Thanks for Sharing.

Skip to main content