Al Nyveldt

Adventures in Code and Other Stories

I found a small bug in my initial release of the VistaDB providers DLL that I released on Friday.  I have made the correction and updated the download.  If you are already using the VistaDB provider, it is only the BlogEngine.VistaDB.dll file that needs to be updated in your site.

Please download the latest version to get the update.

VDBLOGO-Small It is a day later than I had hoped, but I now have my blog running with a VistaDB back end.  I'm thrilled. I've never been a huge fan of putting my personal blog data in SQL Server and I feel free.

I had never intended to move my data to VistaDB Express when I started work for this presentation a few weeks ago, but after working with it for a while and making the providers, I realized I really wanted to use it for my data storage.  VistaDB has a lot going for it as it is managed code, runs in medium trust, runs on mono and is very lightweight.  I'm really most pleased with the xcopy deployment and the nice graphical management tool.  I have heard from others that speed might be an issue, but it seems fine with the small tests I've run.  Inside BlogEngine with the caching we do, I don't see it as an issue.

As I was making some small changes to the code to make it more secure and getting it ready to make available, I decided to go for it.  I fired up my rough migration tool, made a few small changes, and I had a complete copy of my blog posts, pages, comments, settings, and other stuff in a VistaDB database.  I had to manually add my user name in, but since I'm single user it was no big deal.  My small blog database is less than 1 MB and even easier to copy around than a few directories full of XML files.

If you are interested in playing around with it, or following in my footsteps to using VistaDB Express for your blog data, I'm making it all available now.  Complete with instructions.  If you wish to use it, you are required to meet the license agreement of VistaDB Express which states that it is for non-commercial use.  (If you are a commercial operation, you can purchase VistaDB and then use it with BlogEngine without restriction.)

  • Download this file: BlogEngine131VistaDB33.zip
  • Unzip the file and place the 2 dll files in your blog's bin folder.  (Note: one is the VistaDB Express dll and one is the BlogEngine VistaDB providers.)
  • Place the BlogEngine.* files in your blog's App_Data folder.  These 2 files are your initial VistaDB database.
  • Make changes to your web.config to let BlogEngine know to use VistaDB.  I've included samples of the relevant areas below.
  • As per the VistaDB Express license, you should place a link back to VistaDB somewhere on your blog.  (I placed mine in my footer.)

 

Near the top of your web.config
<BlogEngine>
    <blogProvider defaultProvider="VistaDBBlogProvider">
      <providers>
        <add name="XmlBlogProvider"
             type="BlogEngine.Core.Providers.XmlBlogProvider, BlogEngine.Core"/>
        <add name="MSSQLBlogProvider"
             type="BlogEngine.Core.Providers.MSSQLBlogProvider, BlogEngine.Core"/>
        <add name="VistaDBBlogProvider"
             type="BlogEngine.Core.Providers.VistaDBBlogProvider, BlogEngine.VistaDB"
             dataSource="~/App_Data/BlogEngine.vdb3"
             password="" />
      </providers>
    </blogProvider>
</BlogEngine>


Down under system.web

 <membership defaultProvider="VistaDBMembershipProvider" >
   <providers>
     <clear />
     <add name="XmlMembershipProvider"
          type="BlogEngine.Core.Providers.XmlMembershipProvider, BlogEngine.Core"
          description="XML membership provider"
          xmlFileName="~/App_Data/users.xml"/>
     <add name="VistaDBMembershipProvider"
          type="BlogEngine.Core.Providers.VistaDBMembershipProvider, BlogEngine.VistaDB"
          dataSource="~/App_Data/BlogEngine.vdb3"
          password="" />
   </providers>
 </membership>

 <roleManager defaultProvider="VistaDBRoleProvider"
              enabled="true"
              cacheRolesInCookie="true"
              cookieName=".BLOGENGINEROLES">
   <providers>
     <clear />
     <add name="XmlRoleProvider"
          type="BlogEngine.Core.Providers.XmlRoleProvider, BlogEngine.Core"
          description="XML role provider"
          xmlFileName="~/App_Data/roles.xml"/>
     <add name="VistaDBRoleProvider"
          type="BlogEngine.Core.Providers.VistaDBRoleProvider, BlogEngine.VistaDB"
          dataSource="~/App_Data/BlogEngine.vdb3"
          password="" />
   </providers>
 </roleManager>
 

That is it.  If you are interested in checking out the VistaDB database or want to encrypt the database with a password, you can download VistaDB Express.  (User passwords are encrypted inside the database in the User table, but you can encrypt the whole file if you'd like.)  The initial database has the default settings and the initial welcome post you come to expect.

wrenches For my presentation at Philly Code Camp this past weekend, I talked about the provider model and we used BlogEngine.NET as the source code for the talk.  As part of the presentation, I created 3 new providers for BlogEngine.NET to store data in a VistaDB Express database.  These 3 providers allow you to keep most all your blog data in a single database file for easy backup of your site.

In thinking about my presentation, I decided early on I wanted to write new membership, role, and blog providers for the presentation.  I figured it would be helpful to go through the steps in the session and even though no one would want to watch me implement each of the required methods, we would gain a lot by writing a little of the code, putting in the pre-written versions, and then discussing a bit more of it.  A light weight database seemed to be an ideal fit for what I wanted to do. 

You might ask why I chose VistaDB and it is a good question.  I actually was encouraged to go the Sqlite route, but I decided to give VistaDB a try.  I have heard good things about Sqlite, but the fact that I've heard very little about VistaDB other than the fact that Graffiti CMS uses it out of the box, made me curious.  Once I found that they have an Express edition available for open source projects and non-commercial use, I decided to give it a try.  I'll write more about VistaDB soon, but I can say it has a lot going for it and I am really happy with my experience with it so far.

I promised to make my code available so here it is.  The source includes BlogEngine 1.3.1 with the additional files I created.  If you are interested in using the VistaDB implementation with BlogEngine for yourself, check back tomorrow.  I've made a separate project with the necessary files and will make the needed dll, the database, and the web.config changes and I'll give the details on it all tomorrow.  If you just can't wait, you are more than welcome to dig into this code.  It is all here.

Update: I made some updates to the VistaDB providers (security and the like), moved them out of the Core project, and made them into a separate dll for easy installation with the BlogEngine project.  The details and the download can be found here

Philly Code Camp Wrap up

The second Philly Code Camp of the year was this past Saturday and it was a good one.  (I guess my experience tells me they are always "good ones", but it is worth stating that it was in fact good up front.)  Hats off to the Philly.NET crew.  They really do a fantastic job of putting a code camp together.  It was very well organized and really ran through without a hitch.

This was my first time speaking at a code camp and it was a very interesting experience.  While I thought I was ready to present when I arrived, my Macbook Pro, Vista, and the projector had other ideas.  Since I was first up, I was able to get into the room early and get setup.  If it were not for this extra time, my session would have been a disaster.  I wasted about 15 to 20 minutes trying to get the projector to work off my Boot Camp partition (booting directly into Vista) but it wasn't to be.  (And here I thought it would be my best bet.)  Anyway, I finally booted to the Mac OS, and run my presentation through Fusion.  It worked like a champ, but I had wasted the initial 10 minutes of the presentation.

It was a rough start and not exactly what I had planned, but after things settled down, all seemed to go well.  (Ok, I had no further technical difficulties and no one threw rotten vegetables at me.)  In reflection, there are lots of things I'd have changed, but it was all a great learning experience.  I'm sure I had too many uhs and umms, in the talk and I knew I rushed it a bit as I had planned a full agenda and was now working with a compressed time frame.  So it goes.

Beyond my session, I enjoyed a number of interesting sessions and had some nice conversations.  The sessions I attended were all very good and really showed the passion of the presenters.  These people made you want to dig further into the topic after you left the session which is the mark of success in my book.  I never seem to get to talk to all the people I had planned to, but I will admit that by the end of the day, I was exhausted and just ready to go home.  I think I'll make sure I'm better rested for next time.

If you came by looking for my code samples from the presentation.  I will make them available in the next day or so.  Sorry for the delay.

A week from this Saturday, I'll be at the Philly.NET Code Camp 2008.2.  I was at the January Code Camp and had a great time.  There were lots of great people to talk with and interesting sessions that got me thinking about things.

phillydotnet I had met Bill Wolfe, the head of Philly.NET, at MIX08 in March and had offered to be a speaker in the spring Code Camp.  He said to get in touch closer to the camp.  So when the call for speakers went out in early April, I responded.  I was accepted and told a talk on BlogEngine.NET would be great.  I wasn't initially thinking of a BlogEngine.NET talk, but since it is a comfort zone for me I figured it would work out.  There are lots of things I could talk about in relation to BlogEngine.NET so I sent in 3 session summaries and one was chosen.

My topic will be "Learning the ASP.NET Provider model with BlogEngine.NET".  It is a talk that goes into one of the things I really appreciate about BlogEngine.NET.  BlogEngine.NET is an easy to follow, simple project that is great to learn from.  It is a great project to just poke around in the code and see how things work.  Being a relatively small solution with just a web site and a class library project, there isn't much room to get lost.  Also, since there are no 3rd party libraries, you can see how everything works.

My session will get in to the provider model and how BlogEngine.NET uses it.  We'll look at implementing the built in providers like membership and go over making your own implementations of built in providers  Then, we'll spend some time talking about custom providers like the BlogProvider in BlogEngine.NET.  We'll make our own implementation of the BlogProvider as well.  It should be a fun time.

While the talk is very focused on the Provider model, it should be interesting to people curious about BlogEngine.NET as we'll really get into some of the inner workings of how the software works.  Of course, if you are interested in talking BlogEngine.NET or have specific questions, look me up at the Code Camp.  I'd be happy to talk BlogEngine or most any other topic after the session.

About

BioPic Hi. My name is Al Nyveldt and I'm a software developer from central Pennsylvania, USA.

I'm on the BlogEngine.NET development team and write on a variety of development related topics. More...

Follow me on Twitter
Contact me via email

Recent Comments

Quote of the Day

"And remember, no matter where you go, there you are."

- Earl Mac Rauch

Sponsor


Recommended Books



Archives


Disclaimer

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

© Copyright 2008

Sign in