Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Extend meta-models

Describes how to extend meta-models in Business Foundation (BF) in Optimizely Commerce Connect 13.

You can extend meta-models through the use of modules, which is part of the meta-model that provides the main entry point in the client for extensibility objects. Install modules in the system and activate them from the meta-class.

A module consists of the following:

  • A module manifest. Defines information about the module and references to module the configuration.
  • A module configuration. The .NET class that implemented the IModuleConfigurator interface.

The Module Manager loads and calls the Module Configurator methods when a module is activated, deactivated, installed or uninstalled. Each module should implement the Module Configurator.

📘

Note

You can modify a meta-model only in Design mode. See the MetaClassManager class section.

The following classes are available in the Mediachase.BusinessFoundation.Data.Modules namespace.

Default modules

The following modules are default: Change Tracking, History and Localization.

Change Tracking

Change Tracking adds new fields to a meta-class and registers the user and the date and time of modification. After activation, the Change Tracking module adds these meta-fields:

  • Created – Updates this field when a new meta-object is created.
  • Modified – Updates this field when a meta-object is modified.
  • *CreatorId – Copies the current user meta-information from DataContext to this field when a new meta-object is created.
  • ModifierId – Copies the current user meta-information from DataContext to this field when a meta-object is modified.

To get the module manifest, call the CreateModuleManifest of the ChangeTrackingManager class.

History

History saves meta-object modifications to the history meta-class. After activation, the History module creates a meta-class named [MetaClassName]\_History, and creates a copy of the entity object if the selected field is modified. The [MetaClassName]\_History meta-class has an ObjectId field that has the original primary key value.

  • Call CreateModuleManifest of the HistoryManager class to get the module manifest.
  • Call SetSelectedFields of the HistoryManager class, passing the meta-class, to set the collection of selected fields.
  • Call GetSelectedFields of the HistoryManager class, passing the meta-class, to get the collection of selected fields.

You can read the history of the entity object from the [MetaClassName]_History meta-class.

Localization

The Localization module localizes field values.

Do the following to define available languages after installation:

  • Call GetInstalledLanguages of the LocalizationManager class to get installed languages.
  • Call InstallLanguage of the LocalizationManager class passing the culture info Name, to install a new language.
  • Call UninstallLanguage of the LocalizationManager class passing the culture info Name, to uninstall a language.

After activation, define the localizable field. The localization module creates a new field named [FieldName]_[ThreeLetterWindowsLanguageName], which reads or saves localizable values. If the value is null, you should use the original field to get a value. When you add a new language, the localization module automatically creates new fields.

  • Call GetLocalizableFields of the LocalizationManager to get localizable fields.
  • Call ActivateFieldLocalization of the LocalizationManager, passing the meta-class and meta-field, to activate field localization.
  • Call DeactivateFieldLocalization of the LocalizationManager, passing meta-class and meta-field, to deactivate field localization.

Install a module

  • To install a new module, call Install of the ModuleManager class, passing the module manifest and attributes.

Activate a module

  • To activate a module in the meta-class, call Activate of the ModuleManager class, passing the module manifest and meta-class.

Deactivate a module

  • To deactivate a module, call Deactivate of the ModuleManager class, passing the module manifest and meta-class.

Uninstall a module

  • To uninstall a module, call Uninstall of the ModuleManager class, passing the module manifest.