You hear it a lot: Convention Over Configuration. This is the Ruby On Rails mantra and had a lot of merit. At its core it means that what you do (especially if you've done it a lot) should carry a lot more weight than having to configure (and reconfigure) things over and over
First and foremost - if you want to use SubSonic to access your table, you need to have a Primary Key defined for your table. This is good practice in every case and we need it to do certain things with your table. If you don't have a Primary Key defined, your class won't be generated.
Our conventions follow along things that most people do, but we know that we need to be a lot clearer. Here's a list of the things we think are important:
- 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
For lookup tables, the key should be the first column and the "descriptor" (i.e. ProductName) the second column. Many of our lookup functions depend on this.
Column names such as "ShortDescription" will have labels such as "Short Description" in scaffold.
