Defining constant values
There are times when a custom plugin requires the use of constant strings. For example, you need to define constant values when using the PipelineDisplayName attribute in a class to assign names to pipeline blocks.
Follow these best practices when you define constant values in a new plugin:
-
Create one class in your custom plugin to store all constant values.
-
Use the following naming convention for the new class defining constant values:
[FunctionalArea]Constants. For example:PaymentsBraintreeConstants.cs. -
Place the class defining constant values at the root of the plugin project folder.
-
Declare each constant as a public constant string (
public const string). -
Briefly describe the purpose or each constant string.
The PaymentsBraintreeConstants.cs class in the sample plugin project Plugin.Sample.Payments.Braintree (within the Commerce Engine SDK) provides a good example of constants definition class: