logo
logo

Constants

The SDK comes with a number of constants that can be re-used in implementations. Constants can be found in Stylelabs.M.Sdk in the Constants class.

Structure

The constants class consists of multiple subclasses. These subclasses have the following structure.

On one hand we have a class per entity definition (Asset, AssetType, Job...) containing:

  • Definition name
  • Property names
  • Relation names
  • Entity information (values for built-in entities)

Also, there is information about the REST API:

  • The api root path
  • Headers
  • Endpoints
    • Template name
    • Template variables

Extending constants

The constants class can be extended by "wrapping" the default constants.

using Stylelabs.M.Sdk;

namespace Stylelabs.M.WebSdk.Examples
{
    public static class CustomConstants
    {
        public static class Asset
        {
            public const string DefinitionName = Constants.Asset.DefinitionName;

            public const string CustomProperty = "MyCustomPropertyName";
        }
    }
}

Constants from the SDK constants file can be excluded or included as required. Custom constants can also be added.

Can we improve this article ? Provide feedback