-
Notifications
You must be signed in to change notification settings - Fork 12
Naming Conventions
When you write custom stuff please adhere to the rules below to avoid collisions with other developer's stuff. We've decided to standardize on using your church or organizations's domain name as the main naming prefix.
Component/Item | Rule | Example
--------------------- | --------------------------------- | -------------------
Tables | `_<reversed domain>_<tablename>` | _com_mychurch_Book
Classes & Namespaces | `<reversed domain>.<classname>` | com.mychurch.Rock.Book
Assemblies | `<reversed domain>.<project>.dll` | com.mychurch.RockUtils.dll
Custom Block Location | `Plugins/<domain>/` | Plugins/mychurch.com/
Custom API path | `api/<reversed domain>/` | api/com.mychurch/
Custom tables should be prefixed with an underscore followed by your reversed, lowercase domain name --replacing all dots with underscores.
Prefix your namespaces/classes, & assemblies with your reversed, lowercase domain name.
namespace com.mychurch.RockLibrary
{
public class Book
{
public int Id { get; set; }
// ...Put custom blocks into the Plugins folder into a sub-folder named after your organization's domain name.
When developing custom API extensions, developers must use a folder convention api/<com.domain>/ (such as api/com.ccvonline/) to avoid collisions with other custom developer APIs.
If you really want to make the core team happy, you can follow these naming conventions on your entity property/fields:
Data | Field Name Convention | SQL Datatype | C# Datatype | Note
----------- | --------------------- | -------------- | ------------ | ----
Name | Name | nvarchar(100) | string | Grids, Unique, Not Null, Not Empty
Description | Description | nvarchar(max) | string | NoGrid, NotUnique, Optional
Date/Time | ..DateTime | DateTime | DateTime |
Date | ..Date | DateTime | DateTime |
Time | ..Time | DateTime | DateTime |
Url | ..Url | nvarchar(2000) | string | http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url
Birthdate - Month | BirthMonth | int | int |
Birthdate - Day | BirthDay | int | int |
Birthdate - Year | BirthYear | int | int | optional, null means not disclosed
email | ..Email | nvarchar(254) | string | http://stackoverflow.com/questions/386294/maximum-length-of-a-valid-email-address
boolean | Is.. (unless obvious) | bit | bool | 0 = false, 1 = true (try to avoid double negatives, for example "NotEnabled")
First,Middle,Last name | ..Name | nvarchar(50) | string |
FullName | ..FullName | nvarchar(152) | |
Guid | Guid | uniqueidentifier | Guid | Unique, Not Displayed, Not Null, Not Empty, Required Column for Rock Tables
Duration | ..Duration | int | int | a field that implies a number of seconds or minutes of something
Path/FileName | ..Path/Filename | nvarchar(260) | string | http://msdn.microsoft.com/en-us/library/aa365247.aspx
Order | ..Order | int | int |
Currency | ..Amount | decimal (18,2) | decimal | US Dollar Only
Percent | | | | TBD 100%, 1 or 100. 100 reads better
Password | Password | nvarchar(128) | string |
Html | ..Html | nvarchar(max) | string |
PhoneNumber | PhoneNumber | nvarchar(20) | string | store unformatted, no spaces, no dashes, no parentheses
PhoneNumberExtension | [PhoneNumber]Extension | nvarchar(20) | string | store unformatted, no spaces, no dashes, no parentheses
PrimaryKey | Id | int | int |
ForeignKey | `[optional]`+`<ParentTableName>`+Id | int | int |
DefinedValue Foreign Key | `<DefinedType.Name>`+ValueId | | |
BinaryFile Foreign Key | `[optional]`+FileId | | |
Class Name Convention | Description | Example
--------------------- | --------------------------------------------|----------------
`..Picker` | users selecting and picking an item | CampusPicker
`..Uploader` | editor control for selecting or uploading | ImageUploader
`..List` | used for simple list/grid-like controls | ButtonDropDownList