Jim Bonnie's Blog

Sep 18

Written by: jbonnie
Tuesday, September 18, 2007 12:27:56 AM 

This is the beginning of a series of Blog posts on using SubSonic with DotNetNuke. SubSonic is perfect to help simplify module development for people starting out with DNN. It is easy to get overwhelmed with the module development tutorials showing the abstract & concrete data providers, controllers, info classes, and stored procedures.

This is the beginning of a series of Blog posts on using SubSonic with DotNetNuke.

SubSonic is perfect to help simplify module development for people starting out with DNN. It is easy to get overwhelmed with the module development tutorials showing the abstract & concrete data providers, controllers, info classes, and stored procedures.

The standard DNN Module Architecture is a lot of work!!!! But Subsonic can make it a breeze! So let's get started.

Here is a list of what we will need to get started: (this assumes that you have Visual Studio Pro or higher)

1) A DNN Installation - I usually start with the latest install package. DNN 460 was just released, so let's use that. Get it here.

  • Unzip the Install package to a directory
  • Set directory permissions (ASPNET/Network Service)
  • Create empty SQL database, create account as db_owner
  • Create virtual web directory, configure for ASP.NET v2, and default.aspx default document
  • Edit web.config for DB connection strings
  • Browse to http://localhost/vdir - does auto install

2) Install the latest Subsonic application from codeplex. There are excellent guides and tutorials for getting started with Subsonic. After installing subsonic be sure to watch these videos:

3) After having DNN and Subsonic installed and being sure that your DNN installtion runs okay and having watched the videos, let's add Subsonic to our web app.

  • Add the Subsonic section right above the Dotnetnuke section group after the start of the  configSections

    <section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false"/>  

CropperCapture[69].Jpg

  • Add the Subsonic Provider Definition - Right after the Connection string section

<SubSonicService defaultProvider="DNNDAL">

<providers>

<clear/>

<add name="DNNDAL" type="SubSonic.SqlDataProvider, SubSonic"

connectionStringName="SiteSqlServer"

generatedNamespace="DNNDAL"

stripTableText="DNNDAL_"/>

</providers>

</SubSonicService>

CropperCapture[70].Jpg

4) Create a Generated Folder under the App_Code as the output directory for subcommander (sonic.exe)

5) Run the sonic exe tool - be sure to have specified a lang of VB to have it play nice with DNN, and to have the project name highlighted to be sure that sonic.exe picks up the web.config

CropperCapture[73].Jpg

 

6) Check for errors in the output window and double check that all of the sections and providers are correct.

You should get the following results in the App_Code/Generated Folder

CropperCapture[78].Jpg

 

7) Now to make things real easy - Just create a simple ASPX web Form and see that you get intellisence for the autogenerated namespace DNNDAL. Look at the goodness that you get for free

Please note: I made this post in a bit of a hurry and will clean it up and add additional information as I get to review it and based upon any feedback from people willing to give it a try.

Good luck and happy coding.

Tags:

8 comment(s) so far...

Re: SubSonic and DNN 4.60 Part 1 Getting Started

Great intro "how-to" info! I just recently ran across SubSonic while reading up on Ruby/Rails. I can't wait to try some things out (we use DNN quite a bit) and your info will be a big help in getting started. Thanks!

By mamlin on   Thursday, October 04, 2007 2:15:46 PM

Re: SubSonic and DNN 4.60 Part 1 Getting Started

Verrrry interesting- wrapping my head around the DNN DAL has all but extingiushed my desire to build my own modules.
I'll be reading all you have about subsonic + DNN, and giving it a whirl!

By Dan on   Thursday, October 18, 2007 10:26:59 AM

Re: SubSonic and DNN 4.60 Part 1 Getting Started

Yes Dan there is an easier way - just create a standard user control - inherit from portalmodulebase to get the DNN base class behavior and use SubSonic for the basic Data Access. Subsonic gives you all that the DNN Dal gives you and more - for free!

By Jim on   Thursday, October 18, 2007 1:34:12 PM

Re: SubSonic and DNN 4.60 Part 1 Getting Started

i get a stack of errors e.g. ActiveList is not defined, ActiveRecord is not defined...

By alex kwiatkowski on   Monday, November 05, 2007 9:08:36 AM

Re: SubSonic and DNN 4.60 Part 1 Getting Started

Alex - Please try the autoscaffold project or drop me an email so that we can resolve your issue.

Jim

By Jim on   Tuesday, November 13, 2007 9:39:45 PM

Re: SubSonic and DNN 4.60 Part 1 Getting Started

Thank you very much for Your help! 3) was my problem.

By Arthur on   Wednesday, November 28, 2007 7:40:58 PM

Re: SubSonic and DNN 4.60 Part 1 Getting Started

The problem I have is that it generates all code in C#, but my default language in webconfig is set to VB,
ben

By ben on   Thursday, December 06, 2007 10:38:17 PM

Re: SubSonic and DNN 4.60 Part 1 Getting Started

hey Jim,
Happy New year...I was just swinging by to check how things were going on the Subsonic/DNN side.

Anything new to share with us starters?

Your previous articles helped a lot. By the way, I will be having a meeting at work and some peeps in my team (all of them do not know about ORM or Subsonic) are trying to prevent the use of subsonic or any third party tool with out next DNN project. Do you mind giving me pointers to how to expplain/convince them about the advantages of using Subsonic as the DAL for my modules in DNN?

and please, put some articles up for us humble followers...thank you!

--Bebel

By Bebel on   Thursday, January 17, 2008 11:55:00 AM

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 

Navigation

Register Login

About Me

Thanks for stopping by. My name is Jim Bonnie and I have been writing software for over 20 years. After building financial data systems for Reuters for nearly 18 years I have started doing contract work and am excited about technology and currently focus on Microsoft solutions. DotNetNuke has helped provide a good introduction to ASP.NET web application development, and I am now starting to branch out into other areas. Data Access techniques and SubSonic is something that I am looking into now. This has helped me get an invitation to speak at Las Vegas at DNN Open Force 07. it was a great time. And I am looking forward to OpenForce08, where I wil be presenting on TDD for DNN.

 

Reading the codebetter blogs and attending a nothing but .net training class with JP Boodhoo helped spark my interest in ALT.NET. I attended the first conference in Austin Texas, and it was amazing to see Scott Guthrie introduce the ASP.NET MVC framework.

Add to Technorati Favorites

View blog top tags

Links

Jim Bonnie's Blog

Jim Bonnie's Blog

Jim Bonnie's Blog