HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback

Fields represent information that an object contains. Fields are like variables because they can be read or set directly. For example, if you have an object named _Car,_ you can store its color in a field named _Color_.


MetaClass has an optional TitleFieldName property that specifies the name of title field. Be careful to define TitleFieldName with a correct string field name if you want to create a reference to this meta-class.

You can use meta-class to create an entity object, and modify meta-class fields (add, remove) at runtime. When you create and delete meta-classes, remember that you can modify a meta-model only in **Design** mode. See the [MetaClassManager](🔗) class section.

## Get a MetaClass collection

The table collection is available from the MetaClassManager.MetaClasses property, and it returns a MetaClassCollection object.

The following example writes to trace only user tables.

## Delete a meta-class

Call the DeleteMetaClass method of the MetaClassManager class, passing the meta-class object to delete a meta-class. The method removes a meta-class definition and data, references, and permission specifications for that meta-class.

**Example** Find meta-class by name and delete

## MetaClass Card extension

You can extend MetaClass with Cards. To do this, you create a Card field in the meta-class, which is used to save the reference to the current card. Call the CreateCardField method of the MetaClass to create a Card field. Each card can have its own field set, but only one card can be active in the entity object.

If a meta-class has a card field, you can create a Card meta-class. The Card meta-class is visible in a collection of meta-classes like the original meta-class, but will have an IsCard property with the value **true**. You can add meta-fields or delete card meta-classes and common meta-classes.

  • Call the CardOwner property of MetaClass to get the card owner for the current card.

  • Call the SupportsCards property of the MetaClass class to specify whether the meta-class supports cards.

  • Call the GetMetaClassSupportedCard of the MetaClassManager class to get a collection of meta-classes supporting cards.

To start work with the card, create an entity object passing the current card meta-class name to the card field, and all card fields are available in the current entity object. When you save the object, it saves the original common fields, the current card type, and the current card field. Card fields are loaded automatically and are available in the filter expressions.

The following example creates a new Client meta-class, marks that meta-class supports cards, and creates three cards with field sets: _Regional Client_, _Foreign Client_, and _Partner_. If you create a new client object without cards, only meta-class fields are available. But if you set the card property, the fields from the card are available in the entity object automatically.

## Validators

Meta-class supports validation. The Validator ensures that a meta-class is configured properly. Validators are instantiated during runtime when you save the entity object. If a meta-class is not properly configured, the validator throws an exception for the incorrect values.

By default, meta-fields add validators to meta-classes. For example, the email field adds an email validator to check that email property has the correct email, text field, and add maximum length validators.

Call the Validators property of the MetaClass class to get a collection of validators for the current class.

You can create custom validators by creating a class that implements the IValidator, and implement ErrorMessage, the IsValid property, and the Validate method. Then, you can add a validator to the collection of validators for the current class.

If you develop a custom meta-type, you should add your validators in AssignValidators and remove them in the RemoveValidators methods of the meta field installer.

**Example:** CurrencyFieldValidator