New Zealand's new Copyright Law presumes 'Guilt Upon Accusation' and will Cut Off Internet Connections without a trial. is against this unjust law - help us

A Space for All Things .NET Related

ORM101: An Introduction to Object Relational Mappers

By James Hippolite, in , posted: 16-Oct-2008 23:16

I gave a presentation at the Wellington Dot Net User Group last night. I have been asked to supply my notes.

Steps for downloading and installing:

  1. Download
  2. Install
  3. Add External Tool command to Tools menu
    • Title: SubSonic DAL
    • Command: SubCommander/sonic.exe
    • Arguments: generate /out Generated /lang VB
    • Initial directory: ($ProjectDir) Use
    • Output window Prompt for arguments
  4. Add Subsonic Toolbar Customise Add External Tool 1

Steps to Generating DAL classes:

  1. Open new Web Application Project (AdventureWorks)
    1. Open IIS Manager
    2. Enable Directory Security, Integrated Windows Authentication
  2. Add VB Class Library Project (AdventureWorks.DataAccess)
    1. Ensure Project Root Namespace = “AdventureWorks”
    2. Add Reference to Subsonic.dll, System.Configuration, System.Web
    3. Delete Class1.vb
    4. Edit app.config
    5. Add section reference to <configsections>
    6. Add a connection string for each one of your providers
    7. Define Subsonic Service Provider(s) (one per database):
    8. Add Generated folder to DataAccess folder (or project)
    9. Execute Subsonic
  3. Add Existing Item(s)
  4. Build

Using in Web Project:

  1. Add a Business Logic Layer (Class Library)
    • Add References to SubSonic.dll, AdventureWorks.DataAccess
    • Rename Class1 as Product
    • Define the class as Public, decorated with <System.ComponentModel.DataObject()>
    • Define methods as Public, decorated with <System.ComponentModel.DataObjectMethodAttribute(ComponentModel.DataObjectMethodType.Select, True)>
    • Save and Compile
  2. Add a Grid to a Web Page
    • Add Reference to Subsonic.dll
    • Add SubsonicSection to web.config
    • Add SubsonicProvider to web.config
    • Add ConnectionString to web.config. Highlight difference in user ID.
    • Set Default.aspx as Start Page
  3. Build and Run (F5)

Other related posts:
Delivered my Quality Presentation Again
The Microsoft Sync Framework
What's New in Microsoft SQL Services - My DNUG Presentation

Author's note by Dinesh Silva, on 17-Oct-2008 07:58

Hi James,It’s really appreciate for your time last night about ORM.I like to learn this and practice this please let me know where to start from.Also how can I get your DEMO’s what you showed us Y’day.  Appreciate for your reply Thank you  Regards,

Dinesh Silva
Software Developer

Author's note by Jonathan Fry, on 17-Oct-2008 07:59

Hi Kirk,


Thanks for organising last nights session.  I got a lot out of it.  Please pass my thanks on to James as well for his very good presentation.





Comment by Dinesh, on 28-Oct-2008 14:15

Hi James, This is really help full. Thanks again. Dinesh

Add a comment

Please note: comments that are inappropriate or promotional in nature will be deleted. E-mail addresses are not displayed, but you must enter a valid e-mail address to confirm your comments.

Are you a registered Geekzone user? Login to have the fields below automatically filled in for you and to enable links in comments. If you have (or qualify to have) a Geekzone Blog then your comment will be automatically confirmed and shown in this blog post.

Your name:

Your e-mail:

Your webpage:

JamesHip's profile

James Hippolite
New Zealand

Welcome to my technical blog. 

Here, I attempt to distill the Microsoft Certified Professional Developer knowledge I have accumulated since first qualifying MCP in 1996.  This blog started on 13 September 2007 as an off-shoot from my mixed up personal blog.  But it took a shot in the arm from Scott Hanselman's talk at TechEd New Zealand 08 "32 Ways To Make Your Blog Suck Less".