TechTalk Genome v4.2

Schema Definition Language Syntax Guide

Structure of Schema Definition Files

Business classes are mapped to the database by using a data domain schema. It contains mapping information used to provide the data access layer for the application using Genome . The schema is defined in one or more schema definition files which are created in XML format.

When creating the data domain schema, you as the developer use features to describe the mapping. In the schema definition file, each feature describing the schema can be expressed with an XML element. The features that can be used are defined by classes that are named like the element with the postfix XmlData, similar to attribute classes in C#. These XML mapping feature classes can be defined in arbitrary assemblies provided by Genome or extensions to Genome that have to be referenced in the schema definition file. When the schema compiler encounters an XML element while parsing the schema definition file, it tries to find the appropriate feature class in the assemblies referred by the schema definition file. Assembly references can be created using reference directives. The description of the mapping features in this reference guide also contains information about the assembly that has to be referred in order to use the feature.

Some of the XML elements that describe features can be represented as XML attributes as well: instead of creating a sub-element for the feature, an attribute with the name of the feature is created in the parent element.

Feature PersistentField expressed as element:

<Member name=" property ">
<PersistentField [fieldName="database-field-name"] [database-type-modifiers] />
</Member>

Feature PersistentField expressed as attribute:

<Member name=" property "
PersistentField=" database-field-name "
/>

This guide informs you whenever an element can be alternatively defined as an attribute.

The XML element or attribute referring to a feature mapping can either be named using the full qualified name of the feature class (without the XmlData tail)or the short name without the namespace qualifier. When using short names, the namespace of the feature class has to be listed in one of the using directives. The syntax description of the mapping features in this reference guide uses the short names of the features. In the detailed description for each feature, the full name is listed as well.

Because the mapping information is applied to types and members participating in the business layer of the application, the schema definition file follows the type-member hierarchy. The standard elements describe the XML elements that can be used to build up the base structure of schema definition files.

Compiling the Data Domain Schema

A data domain schema can be compiled from one or more schema definition files. Although a type is usually mapped in only one file, mapping information for types and members can be can be split up in many separate files.

Genome provides platform-specific default mapping files that describe the mapping of the basic types. The default mapping file for the targeted platform has to be compiled together with the source files that contain the mapping information of the business classes. Since the platform- specific default files are compiled into Genome 's assemblies as resources, they can be referenced without a folder name as source parameters of the schema compiler .

The data domain schema is compiled from the source schema definition files by using the schema compiler . The output of schema compilation is an assembly that contains proxy classes generated for the business layer types and the serialised data domain schema. The compiled schema can be used in applications by loading it from the assembly using the DataDomainSchema.LoadFrom method.

Developing applications using Genome

Developing applications with Genome consists of developing the business layer and the user interface of the application. Additionally, you need to create the schema definition files. Using the compiled business layer and the schema definition files, the schema compiler creates the schema assembly which contains the proxy classes for the business types and the serialised schema. The schema assembly is deployed with the business layer assemblies and is used during the applications's runtime.


Figure 1: Building applications

Schema assemblies contain information about the business classes and the mapping described in the schema definition files. They have to be recompiled when the business classes or the schema definition files are modified. A schema assembly's version information includes the date and time when the asssembly was created and the list of assemblies that the schema assembly has been compiled from.