101 - Launchpad (Rockumentation)

Naming Conventions

Here are some rules to follow so your stuff doesn't collide with other's stuff. We've decided to standardize on using your organizations's domain name as the main naming prefix. Keep reading, you'll see what we mean below.

Quick Reference

Important

In all cases below the "domain" (reversed.domain, etc.) MUST be lowercase.

ItemRuleExample
Project Naming<reversed.domain>.<Project Name>org.mychurch.MyProjectName (domain is always lowercase)
Tables_<reversed_domain>_<project>_<tablename>_org_mychurch_MyProjectName_Book
Stored Procedures_<reversed_domain>_sp<project and/or component>_org_mychurch_spWidgetGet
User Functions_<reversed_domain>_unf<project and/or component>_org_mychurch_unfWidgetCalc
Action Categorization<Organization Name>: <category name>[Category( "My Church: MyActionCategory" )] or include a locality/identifier if your organization's name is common[Category( "My Church (AZ): MyActionCategory" )]
Lava Shortcodes<reversed_domain>_<shortcode tag-name>{[ org_mychurch_supermap ... ]}
Block Categorization<Organization Name> > <category name>[Category( "My Church > My Category" )] or include a locality/identifier if your organization's name is common[Category( "My Church (AZ) > My Category" )]
Block LocationRockWeb/Plugins/<reversed_domain>/<project>/RockWeb/Plugins/org_mychurch/MyProject/
Block NamespaceRockWeb.Plugins.<reversed_domain>.<project>RockWeb.Plugins.org_mychurch.MyProjectName
Class Namespace<reversed.domain>.<project>org.mychurch.MyProjectName
Assemblies<reversed.domain>.<project>.dllorg.mychurch.MyProjectName.dll
API pathapi/<reversed.domain>/api/org.mychurch/
API v2 pathapi/v2/plugins/<reversed.domain>/<project>/api/v2/plugins/<reversed.domain>/<project>/controls/api/v2/plugins/<reversed.domain>/<project>/models/api/v2/org.mychurch/myplugin/api/v2/org.mychurch/myplugin/controls/api/v2/org.mychurch/myplugin/models/
Attribute "Key" names (except Block Attributes)<reversed_domain>_<variable>org_mychurch_AmazingWidgetFoo
Private Class Property_<property>_fooId
Querystring Parametersuse field/property case (Pascal Case)GroupId
Webhook filename_<reversed_domain>_... or <org initials>_... (again, to prevent collisions with other plugin developers)_org_mychurch_Mailgun.ashx or mc_Mailgun.ashx
Or Webhook folderWebhooks/<reversed_domain>/Mailgun.ashxWebhooks/org_mychurch/Mailgun.ashx

Note

The domain name is always in lowercase.For blocks, block location, attributes, and sql stuff, the reversed domain uses an underscore (_) instead of a dot. This is intentional to help prevent namespace resolution conflicts. Also, using a dot can be problematic when used in Lava.

Important

To avoid collisions with admin created attributes, the Rock core team will prefix attribute's attribute [Key] with "core_". Example: core_LastSendDate

SQL: Custom Tables, Stored Procedures, User Functions

Custom tables should be prefixed with an underscore followed by your reversed, lowercase domain name, then your ProjectName -- replacing all dots with underscores.

Custom Namespaces, Classes & Assemblies

Prefix your namespaces/classes & assemblies with your reversed, lowercase domain name, then your ProjectName.

namespace org.rocksolidchurch.MyProjectName
{
    public class Book
    {
        public int Id { get; set; }
        // ...

Private class properties should be prefixed with an underscore as illustrated here.

#region Fields

private int? _fooId;
private Note _note;

#endregion

Custom API

When developing custom API extensions, you must use a folder convention api/<com.domain>/ (such as api/org.rocksolidchurch/) to avoid collisions with other custom developer APIs.

Standard Control Variable Naming

If you really want to make the core team happy, you can follow these naming conventions on your entity property/fields:

Control TypePrefixExample
AccountPickeracctp
AutoCompleteDropDownacacPersonSelect
AttributeEditoredtedtGroupMemberAttributes
BadgebadgebadgeNotice
BinaryFilePickerbfp
BinaryFileTypePickerbftp
BirthdayPickerbdayp
BootstrapButtonbbtnbbtnSearch
ButtonbtnbtnSendLogin
ButtonDropDownListbddl
CampusesPickermcamp
CampusPickercamp
CategoryPickercatpcatpCategory
CheckBoxcbcbUnlisted
CheckBoxListcbl
CodeEditorce
CompareValidatorcoval
ComponentPickercomp
ConfirmPageUnloadconpu
CustomValidatorcval
DataDropDownListddlddlDataView
DataPagerdpgr
DataTextBoxdtbdtbDescription
DatePickerdpdpAnniversaryDate
DateRangePickerdrp
DateTimePickerdtpdtpFutureSendAt
DropDownListddl
EntityTypePickeretp
FieldTypeListftl
FileUploadfup
FileUploaderfupr
GeoPickergeop
GridggMembers
GridFiltergfgfSettings
GroupPickergp
GroupRolePickergrp
GroupTypePickergtp
HelpBlockhb
HiddenFieldhfhfValue
HighlightLabelhlblhlblUrgent
HtmlEditorhtml
HyperLinkhl
Imageimg
ImageButtonimb
ImageUploaderimgupimgupPhoto
LabellbllblApprovedByPerson
LinkButtonbtnbtnLoginLogout
ListViewlv
LiteralllPostText
LocationItemPickerlocip
LocationPickerlocp
MergeFieldPickermfp
ModalAlertmamaDeleteWarning
ModalDialogmdmdPreview
ModalPopupExtendermpe
MonthDayPickermdp
MonthYearPickermyp
NewFamilyMembersnfmnfmMembers
NoteContainernotenoteComments
NotificationBoxnbnbError
NumberBoxnumb
NumberRangeEditornre
PagePickerpageppagepRedirectTo
PanelpnlpnlValue
PanelWidgetpnlwpnlwDisplay
PersonPickerppppGroupMemberPerson
PersonProfileBadgeListbadgel
PlaceHolderphphSuccess
PostBackTriggertrgr
RadioButtonListrbl
RepeaterrptrptCompletedPledges
RockBulletedListblst
RockCheckBoxcbcbValue
RockCheckBoxListcbl
RockControlWrapperwrap
RockDropDownListddlddlGender
RockLiterall
RockRadioButtonListrblrblStatus
RockTextBoxtbtbEmail
ScheduleBuilderschedb
SecurityButtonsbtn
SlidingDateRangePickersdrpsdrpFeeDateRange
StateDropDownListstatep
Tabletbl
TagListtagl
TermDescriptiontermdtermdTransactionCode
TextBoxtbtbNewNote
TimePickertimeptimepStartTime
Toggletgl
UpdatePanelupnlupnlSettings
ValidationSummaryvalvalSummaryTop
XmlxmlxmlContent

Note

Items shown in bold are the most frequently used controls.

We'd also recommend these naming conventions on your entity property/fields:

DataField Name ConventionSQL DatatypeC# DatatypeNote
NameNamenvarchar(100)stringGrids, Unique, Not Null, Not Empty
DescriptionDescriptionnvarchar(max)stringNoGrid, NotUnique, Optional
Date "Key"..DateKeyintintThis is essentially a FK to the AnalyticsSourceDate.DateKey (yyyymmdd) table/column for additional date analytics (useful for cases like 'select only Sunday dates').
Date/Time..DateTimeDateTimeDateTime
Date..DateDateTimeDateTime
Time..TimeDateTimeDateTime
Url..Urlnvarchar(2000)stringhttp://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url
Birthdate - MonthBirthMonthintint
Birthdate - DayBirthDayintint
Birthdate - YearBirthYearintintoptional, null means not disclosed
email..Emailnvarchar(254)stringhttp://stackoverflow.com/questions/386294/maximum-length-of-a-valid-email-address
booleanIs.. (unless obvious)bitbool0 = false, 1 = true (try to avoid double negatives, for example "NotEnabled")
First,Middle,Last name..Namenvarchar(50)string
FullName..FullNamenvarchar(152)
GuidGuiduniqueidentifierGuidUnique, Not Displayed, Not Null, Not Empty, Required Column for Rock Tables
Duration (OBSOLETED)..Durationintinta field that implies a number of seconds or minutes of something
Duration (as of v11)..Duration{UnitOfTime}int, decimal (18,2) or floatint, decimal or doublewhere {UnitOfTime} is Seconds, Milliseconds, Days, Hours, Weeks, etc.
Path/FileName..Path/Filenamenvarchar(260)stringhttp://msdn.microsoft.com/en-us/library/aa365247.aspx
Order..Orderintint
Currency..Amountdecimal (18,2)decimalUS Dollar Only
PercentTBD 100%, 1 or 100. 100 reads better
PasswordPasswordnvarchar(128)string
Html..Htmlnvarchar(max)string
PhoneNumberPhoneNumbernvarchar(20)stringstore unformatted, no spaces, no dashes, no parentheses
PhoneNumberExtension[PhoneNumber]Extensionnvarchar(20)stringstore unformatted, no spaces, no dashes, no parentheses
PrimaryKeyIdintint
ForeignKey[optional]+<ParentTableName>+Idintintex. see Note's NoteTypeId
DefinedValue Foreign Key<DefinedType.Name>+ValueIda ref to a DefinedValue of a DefinedType
BinaryFile Foreign Key[optional]+BinaryFileId or [optional]+FileIdex. Page's IconBinaryFileId

Utility Class Naming Conventions

Lastly, here are a few conventions for any UI controls you might create:

Class Name ConventionDescriptionExample
..Pickerusers selecting and picking an itemCampusPicker
..Uploadereditor control for selecting or uploadingImageUploader
..Listused for simple list/grid-like controlsButtonDropDownList