The Mapping file

Note: This Information is out-dated and needs a revision.

The NDO mapping file (per default NDOMapping.xml) is an Xml file. In this schema description elements appear bold and attributes appear bold italic. An Xsd schema of the NDO mapping file format is deployed with NDO and can be found in the NDO installation directory.

NDOMapping

Connections

Connection - Details about connection strings that are used for database connections.

Name: The connection string

ID: Is used to refer from the class elements to a connection. Format: C<n> with <n> being an integer number.

Type: Name of the NDO provider to be used. The name must match the Name property of an instance of the desired provider.

Classes

Class - Mapping information for persistent classes

AssemblyName: Module name of the assembly in which the class is defined.

FullName: Fully qualified type name of the class.

TableName: Name of the table to which the class is mapped. NDO creates a name that corresponds to the class name. A qualified table name can also be used like
[SCOTT].[Employee] (mandatory for Oracle databases).

ConnectionId: Reference to the ->Connection element which denotes the database, where the table resides.

TimeStampColumn: Column with a Guid for collision protection. The Guids data type is used if it is supported by the database; otherwise a string column is used.

Oid

ColumnName:Column name with the unique ID of an object; usually the primary key column.

FieldName: (Optional) A normal persistent field can be used as oid column if the oid values are not generated by the database. This attribute holds the name of the field to be used as ObjectId.

ParentRelation: (Optional) This entry is necessary with Intermediate Class Mappings. It contains a fieldname of a relation. In the case of Intermediate Class Mappings objects don’t have their own ObjectId. The object identity is determined by two foreign keys which are defined in two Relations, ParentRelation and ChildRelation. The value of this attribute denotes the fieldname of an existing relation of the same class.

ChildRelation: (Optional) This entry is necessary with Intermediate Class Mappings. It contains a fieldname of a relation. In the case of Intermediate Class Mappings objects don’t have their own ObjectId. The object identity is determined by two foreign keys which are defined in two Relations, ParentRelation and ChildRelation. The value of this attribute denotes the fieldname of an existing relation of the same class.

Fields

Field

Name: Name of the field to be mapped.

ColumnName: Name of the database column, in which the field value is stored.

ColumnType: (Optional) Defines a database type to which the field value should be converted.

ColumnLength: This value is submitted as Size Property of the parameter objects of the ADO.NET command objects. If necessary this value is also used for the SQL script to generate a column of a certain length.

ColumnPrecision: (Optional) Number of digits after the decimal point. If this attribute exists, a tupel (l,p) is created in the SQL script where l is the ColumnLength and p is the ColumnPrecision.

IgnoreLengthInDDL: If set to ‘True’, ColumnLength and ColumnPrecision are ignored while creating the SQL script; No size information appears in the column definition in the SQL script. Set this property to True if you need a size parameter in the IDbCommand parameter, but don’t need a size definition in the SQL script.

Relations

Relation - Mapping information for relation fields

FieldName: Name of the relation field.

ReferencedTypeName: Fully qualified name of the referenced type.

ForeignKeyColumnName: Name of the foreign key column to be used for the relation. It depends on the relation cardinality as to which table holds this column:

Cardinality 1: The foreign key column is in the own table assigned to the class, containing the relation.

Cardinality n: The foreign key column is in the table assigned to the referenced class.

n:n relations, or polymorphic relations with cardinality n: The foreign key column is in the mapping table.

Note that if a mapping table is explicitly defined for non-polymorphic relations with cardinality 1 and n, the foreign key column is in the mapping table.

ForeignKeyTypeColumnName: (Optional.) In the case of polymorphic classes this attribute gives the name of the column holding the type code of the stored or referenced object.

RelationName: (Optional) Is used to distinguish several relations to the same target class. The default value is String.Empty.

MappingTable (Optional) A MappingTable is needed for n:m relations or if a mapping table is explicitly defined.

TableName: Name of the mapping table.

ConnectionId: Refers to the connection under witch the table can be reached.

ChildForeignKeyColumnName: In case of n:n relations this attribute denotes the foreign key column pointing to rows in the table of the referenced class. The column always resides is in the mapping table.

ChildForeignKeyTypeColumnName: For polymorphic classes this attribute gives the name of the column that holds the type code of the referenced object. The column is always of type integer.