SubSonic 3.0 Example Project


SubSonic 3.0 Example Project

Oct, 06, 2011

This is a quick console app I put together to demonstrate how SubSonic 3.0 can be used for querying a database. It targets Northwind on SqlExpress.

Download it now

Currently it demonstrates:

  • Retrieving a single record using SingleOrDefault.
  • Retrieving all records using All.
  • Retrieving a Queryable of records based on some criteria using Find.
  • Using Linq query syntax to query.
  • Paging.
  • Filtered paging.
  • CRUD operations.
  • Relationships.
  • Extending generated classes.
  • Attaching DataAnnotations to generated classes.

If you need the Northwind scripts, they're available from Microsoft here

I learned a lot while doing this, specifically about the somewhat poor support SubSonic offers for relationships. Rather than bitch and moan about it like I've found everyone else is doing however, I'm going to try (I say this now) to do something about it. I've already got some ideas on how it will work in my head, I think the most difficult part for me will be working with the T4 templates. Will post more about that later.

I also promised someone that I would post my template modifications for allowing IncludeTables. When I find them I will do just that.


Tags: SubSonic

Contact

Recent Posts

Entity Framework update-database "Could not load file or assembly or one of its dependencies. The system cannot find the file specified."

I spun wheel for a while on this one. Every time I ran the update-database or add-migration command I was getting "Could not load file or assembly 'MyProject.Name' or one of its dependencies. The... Read More

You get nahzing, Lebowski!

Windows 8 CP to Windows 8 RP doesn't give you many choices on what I get to keep when I upgrade. Guess I won't be needing that "Help me decide" link.... Read More

 
@nickspiers