Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

A standard property stores a single unit of data; a multi-language property stores one unit of data per data language defined in the modelthe Modell Sprachen.

Usage

Call ClassBuilder.Add.MultiLanguageProperty(...) on a ClassBuilder in a metadata builder to Builder API to add a multi-language property to that class.

Code Block
Elements.Person.Add.MultiLanguageProperty("Notes");

The default type of the property is MetaType.Text, but you can make multi-language properties for any type.

Code Block
Elements.Person.Add.MultiLanguageProperty("Attachment", MetaType.Binary);

Structure

Adding a multi-language property includes the following properties in the class:

  • A calculated property with the original name (e.g. "Notes" above) that returns the value of the language-specific property for the current the current language

  • A property for each data language in the modelthe model

The multi-language property itself has a list of Properties that contains the language-specific properties.

Naming

The name of the multi-language property is taken from the parameter passed to the builder method. The names of the language-specific properties are generated using IMetaNameTools.GetName() (for which an application can register its own service). By default, the service appends the name of the language (e.g. "Notes_en").

Storage

The ORM and schema-migration both The ORM and schema-migration both support multi-language properties. A multi-language property maps to n columns in the database table of its meta-class, one for each data language.

Code-Generation

The generated metadata and generated classes both Modell Generieren and generated classes both support multi-language properties.

...

In addition to the getter for the calculated property (e.g. Notes), the generated class includes two methods to provide statically typed access to the language-specific values (e.g. GetNotes(ILanguage language) and SetNotes(ILanguage, string)).

Layouts

Call the LinkMultiLanguage(...) on a LayoutBuilder to add the property to the given layout. Per default this will add:

...