This project is read-only.

Multiple Blog Per SQL

Topics: ASP.NET 2.0, Business Logic Layer, Themes
Mar 31, 2010 at 11:38 PM

I have been reading about the discussions pertaining to multiple Blogs per instance of BE.  But I am looking for something just a little different.  I would like to setup BE in two different ways...

1.  A demo setup for me that use the same BE SQL tables for posts but use a different theme... Right now when I point multiple BEs to the same SQL tables the Theme Settings only work for 1 at a time.

2.  I would like to also support multiple BE instances that all point to separate SQL tables in the same Database Server to reduce the amount of overhead...there does not seem to be any easy answers.

Are there any simple answers??  I would just like clarification because everyone says 'multiple instance' but they are generally talking about something different than what I am for SQL tables most of the time, I expect.



Apr 1, 2010 at 12:47 AM

For # 2, with multiple BE instances, you can have separate tables in the same DB.  This is accomplished by giving each set of tables a different prefix.  The standard prefix is "be_".  You can use other prefixes, like:


... etc..

In the web.config file of each instance, there's the BlogEngine providers section.  For the DbBlogProvider, you would specify the table prefix there.  Like this:

<add name="DbBlogProvider" type="BlogEngine.Core.Providers.DbBlogProvider, BlogEngine.Core" connectionStringName="BlogEngine" tablePrefix="be_Craig_" />

And then this particular BE instance, will use the set of tables prefixed with be_Craig_.

For # 1, you could make a somewhat trivial modification to the BE code so it would choose a different theme based on some set of conditions.  The blog post below shows where the theme (aka master page) is set.  It's in the BE core.  You could add logic there that determines which theme is applicable and use that theme.