Geeks With Blogs
Scott Kuhl Warning: I may have no idea what I am talking about!


Instead of accessing the data functions directly, the Controller design pattern is recommended. To implement this, create a Controller class in the App_Code directory.

public class ProductController

Then add methods to retrieve the data using collections.

public ProductCollection GetAllProducts()

And to update the data.

public void UpdateProduct(Product product)

While there is nothing enforcing these rules, it will make it easier to insert business rules and re-use methods from a single location.


These conventions are pulled directly from the SubSonic documentation.

  • Every database table needs to have a primary key. You can't use SubSonic if this isn't the case.
  • Integer-based keys are preferable, for performance. I personally use GUIDs only as identifiers and not keys. This isn't required.
  • Every table should have some auditing ability built in, but this is not required. These fields are:
    • CreatedOn (datetime)
    • CreatedBy (nvarchar(50))
    • ModifiedOn (datetime)
    • ModifiedBy (nvarchar(50))
  • If you want to use logical deletes, you can by adding a field called "Deleted" or "IsDeleted"
  • Table names should be singular
  • Column names should never contain reserved words (system, string, int, etc)
  • Column names should not be the same as table names

Find the entire series of posts here.

Posted on Friday, December 8, 2006 2:06 PM SubSonic | Back to top

Comments on this post: Getting Started with SubSonic - Part 23, Conventions

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Scott Kuhl | Powered by: