Loading...
Area: Optimizely Commerce
Applies to versions: 10 and higher
Other versions:

MetaType class

Recommended reading 

The MetaType class represents the field type declarations string, HTML text, number, enums, file, and image. MetaType includes common types, and you can extend it with UI-friendly types. For example, instead of using one type of string, Business Meta-Model has Short String, Long String, HTML, Email, Phone and number. You can create a new MetaType based on system type or create a custom one. 

Business Foundation (BF) lets you use a number of different meta types for your .NET applications. You can use the included meta-types or implement a custom meta-type.

Default meta-types

Call the RegisteredTypes method of MetaClassManager class to get all registered meta-types. The following table shows ready-to-use BF meta-types.

Creating a meta type based on system type

You can create a new meta-type based on system type. You can find a complete list of system types in the McDataType enumerators.

To create a meta-type, such as Geolocation based on the String system type, open the edit scope and add a new MetaFieldType object to the MetaClassManager.RegisteredTypes collection.

Or, add a new record to the mcmd_MetaFieldType table and restart the application.

*INSERT INTO mcmd_MetaFieldType ([Name], [FriendlyName], [McDataType]) VALUES ('Geolocation', 'Geolocation ', 6

After registration, you can add a geolocation field to the meta-class. Using the meta-type name, you can load a new geolocation view and edit the UI control.

Creating a custom meta type

When implementing a custom meta-type, you need to create the Meta-field installer and Meta-field property binder. When you create a meta-field, BF calls the meta-field installer to process meta-field into SQL columns. When you load an entity object, BF calls the meta-object property binder to convert values from an SQL column to a meta-field value.

To create a custom Meta-field installer, you create a class that implements the IMetaFieldInstaller interface, and implement the following methods.

To create a custom Meta-object property binder, create a class that implements the IMetaObjectPropertyBinder interface, and implement the following methods.

You should register the custom meta-field installer and meta-object property binder in the mediachase.businessFoundation.data/metaObject/types section of the application config file.

<mediachase.businessFoundation.data>
<metaObject>
  <types>
    <add name="CustomType" installer="" binder="" />*
  </types>
Do you find this information helpful? Please log in to provide feedback.

Last updated: Oct 24, 2016

Recommended reading