Metadata Plus (MDP) 2.0 is the underlying engine for some Episerver Commerce subsystems, such as the Catalog and Order systems. The engine was developed for use in the eCommerce Framework of Episerver Commerce. MDP lets you extend any system object with a series of meta-fields. It is similar to object-oriented programming. For example, in object-oriented programming, you can create a base Product class then a Product type object called ElectronicProduct, which inherits its properties and adds specific fields.
How it works
The root meta-class is based on a database table called system meta-class. Consider that an abstract meta-class which you must extend to use when associating extended new attributes with a new meta-class. Product becomes a system meta-class, and ElectronicProduct becomes a meta-class that you can extend. The instance of the meta-class that holds values is called meta-object.
|Binary||MSSQL Common Type|
|Bit||MSSQL Common Type|
|Char||MSSQL Common Type|
|DateTime||MSSQL Common Type|
|Decimal||MSSQL Common Type|
|Float||MSSQL Common Type|
|Image||MSSQL Common Type|
|Int||MSSQL Common Type|
|Money||MSSQL Common Type|
|NChar||MSSQL Common Type|
|NText||MSSQL Common Type|
|NVarChar||MSSQL Common Type|
|Real||MSSQL Common Type|
|UniqueIdentifier||MSSQL Common Type|
|SmallDateTime||MSSQL Common Type|
|SmallInt||MSSQL Common Type|
|SmallMoney||MSSQL Common Type|
|Text||MSSQL Common Type|
|Timestamp||MSSQL Common Type|
|TinyInt||MSSQL Common Type|
|VarBinary||MSSQL Common Type|
|VarChar||MSSQL Common Type|
|Variant||MSSQL Common Type|
|Numeric||MSSQL Common Type|
|Sysname||MSSQL Common Type|
Not all properties have a visual designer associated with them, but you can use all of them to extend the meta-class.
The MDP is designed to give the resulting database structure the fastest performance. When a meta-class is created, the container data table and history tables are created with a corresponding set of stored procedures and full text indexes (if full text functionality is enabled). The appropriate indexes also are put.
Metadata fields and classes
Meta-fields describe different properties associated with an element inside Episerver Commerce. You can create a meta-field of any type supported by Metadata Plus.
Episerver Commerce uses meta-classes to describe different types of elements, such as Categories and Products, that are used in the creation and extension of the commerce solutions developed. Meta-class is a collection of meta-fields. The following types of meta-classes are defined:
- Mediachase.MetaDataPlus.System. Used for the built-in CatalogNode and CatalogEntry elements of Episerver Commerce.
- Mediachase.MetaDataPlus.User. Created when a user defines a new meta-class for a Category or Product. It is always an extension of one the existing System meta-classes.
Using MetaClasses and MetaFields
It is important to understand the concepts of a meta-class and meta-field, which form the basis for Categories and Products, to fully understand how they work within Episerver Commerce. For a better understanding of meta-fields and meta-classes, consider an example of creating a product Book. This product, Book, has the following properties:
To duplicate this product inside your solution, create a BookClass meta-class with the Entry meta-class as its parent. In this example, BookClass is of type Mediachase.MetaDataPlus.User, and the built-in Product meta-class is of type Mediachase.MetaDataPlus.System.
Next, assign the properties of Book to your BookClass by creating a meta-attribute for each Property, then assigning them to your BookClass. For example, the Name property could be a meta-attribute of type ShortString, and Price can be a meta-attribute of type int. After you create these meta-attributes, assign them to your BookClass.