Documentation

NPersist XML Mapping File Format

This document describes the format for the NPersist XML mapping files.

The NPersist XML mapping file format only uses elements, no attributes at all. That means that in the overview below, when you see a tag without an end tag (such as the <Name> tag under the <DomainMap> node) this does not represent an attribute. Rather, the end tag is just left out of the overview, for brevity. When creating your XML files, you should write <Name>TheName</Name>. End tags are only included in the overview to indicate the encapsulation of subtags.

The only schematic constraint on the XML file is that it must be deserializable to the corresponding NPersist object model by .NET Xml Deserialization. However, when the file is consumed by NPersist, it will be further verified by the framework, checking for all types of inconsistencies (such as classes mapping to tables missing in the source maps).

NPersist XML Mapping File Format, Overview

<DomainMap>		//The domain map

  <Name>		//The name of your domain map.
  <Source>		//The name of the data source map you want to use as default.
  <RootNamespace>	//The common root namespace for the classes in the domain.
  <IsReadOnly>	//(Bool) Indicates if all classes in this domain map are read-only.
  <FieldPrefix>	//The default prefix for the private field variables.
  <MergingBehavior>	//The merging behavior to be used as default.
  <MetaData>	//Any additional data.
	

  <ClassListMapPaths>	//List of paths to separate files with class maps
  <SourceListMapPaths>	//List of paths to separate files with source maps

  <ClassMaps>		//The list of classes in the domain

    <ClassMap>		//Describes a domain class.

      <Name>			//The name of the class.

      <Source>			//The name of the data source that the class is mapping to. Leave empty to use default source.
      <Table>			//The name of the table that the class is mapping to.

      <IsAbstract>		//(Bool) If true, indicates that the class can't be instantiated.
      <InheritanceType>		//(Enum) The pattern used for implementing an eventual inheritance hierarchy in the database.
      <IsReadOnly>		//(Bool) Indicates if the class map is read-only.
      <MergingBehavior> 	//The merging behavior to be used as default for the class.

      <IdentitySeparator>	//The string used for separating the values of multiple identity properties.
      <InheritsClass>		//The class (if any) that this class inherits from.
      <TypeColumn>		//The name of the column containing the type discriminator for the class. Applies only to SingleTableInheritance.
      <TypeValue>		//The type discriminator value for the column specified as TypeColumn. Applies only to SingleTableInheritance.

      <MetaData>		//Any additional data.
      
      <PropertyMaps>		//The list of properties in the class

        <PropertyMap>		//Describes a property

          <IsIdentity>			//(Bool) Indicates if the property is an identity property.
          <IdentityIndex>		//Indicates the index of the identity property. Applies only when a class has multiple identity properties.

          <Name>			//The name of the property.
          <DataType>			//The data type of the property.
          <ItemType>			//The data type of items in a collection property.
          <DefaultValue>		//The default value for the property.
          <IsCollection>		//(Bool) Indicates if the property is a collection property (accepting multiple values).

          <Accessibility>		//(Enum) The accessibility for the property.
          <FieldAccessibility>		//(Enum) The accessibility for the private field that the property is mapping to.
          <FieldName>			//The name of the private field that the property is mapping to. If you leave blank, the name of the property will be used, prefixed by the standard field prefix specified in the domain map.

          <ReferenceType>		//(Enum) The type of reference that this property is part of: ManyOne, OneMany, ManyMany or OneOne.

          <Inverse>			//The name of this property's inverse property. Applies only to bi-directional reference properties.
          <NoInverseManagement>		//(Bool) Indicates if standard inverse managment should be applied.
          <InheritInverseMappings>	//(Bool) Indicates if this property should inherit its mapping settings from its inverse property.


          <Source>			//The name of the data source that the property is mapping to. Leave empty to use the source specified in the class map.
          <Table>			//The name of the table that the property is mapping to. Leave empty to use the table specified in the class map.
          <Column>			//The name of the column that the property is mapping to.
          <IdColumn>			//The name of the identity column that the property uses to find values belonging to it. Applies only to collection properties and non-primary properties.
          <AdditionalColumns>		//List of the names of any additional columns that this property is mapping to. 
          <AdditionalIdColumns>		//List of the names of any additional identity columns that this property is mapping to. 

          <LazyLoad>			//(Bool) Indicates if this property should be lazy loaded.
          <IsReadOnly>			//(Bool) Indicates if this property is read-only.
          <NullValueSubstitute>		//The value that should be used as substitute for Null values in the database.

          <CascadingCreate>		//(Bool) Indicates if the cascading create feature should be used for this property.
          <CascadingDelete>		//(Bool) Indicates if the cascading delete feature should be used for this property.

          <MetaData>			//Any additional data.

        </PropertyMap>

      </PropertyMaps>

    </ClassMap>

  </ClassMaps>

  <SourceMaps>		//The list of data sources in the domain.

    <SourceMap>

      <Name>			//The name of the data source.
      <SourceType>		//(Enum) The type of the data source (MS Sql Server, MSAccess, Oracle, etc..)
      <ProviderType>		//(Enum) The provider that should be used for communication with the data source.
      <ConnectionString>	//The connection string/DNS to the data source.
      <Schema>			//The name of the data source schema (normally "dbo").
      <Catalog>			//The name of the data source catalog.
      <MetaData>		//Any additional data.

      <TableMaps>		//The list of tables in the data source

        <TableMap>		//Describes a table 

          <Name>		//The name of the table.
          <MetaData>		//Any additional data.

          <ColumnMaps>		//The list of columns in the table

            <ColumnMap>		//Describes a column

              <Name>			//The name of the column
              <DataType>		//(System.Data.DbType) The data type of the column. 
              <Length>			//The length (in bytes) of the column
              <IsAutoIncrease>		//(Bool) Indicates if the column is an auto-increasing column.
              <Format>			//The format that should be used for values to the column. Applies only to date/time columns.
              <AllowNulls>		//(Bool) Indicates if the column accepts Null values.
              <IsPrimaryKey>		//(Bool) Indicates if the column is part of the primary key for the table.
              <IsForeignKey>		//(Bool) Indicates if the column is part of a foreign key.
              <Increment>		//The increment for the column. Aplies only to auto-increasing columns.
              <Seed>			//The seed value for the column. Aplies only to auto-increasing columns.
              <DefaultValue>		//The default value for the column.
              <Precision>		//The precision of the column.
              <Scale>			//The scale of the column.
              <PrimaryKeyColumn>	//The name of the primary key column that this column is mapping to. Applies only to foreign key columns.
              <PrimaryKeyTable>		//The name of the table with the primary key column that this column is mapping to. Applies only to foreign key columns.
              <IsFixedLength>		//(Bool) Indicates if the column is of fixed length. Applies only to Binary columns.
              <Sequence>		//The name of an eventual sequence that this column may be mapped to.
              <MetaData>		//Any additional data.

            </ColumnMap>

          </ColumnMaps>

        </TableMap>

      </TableMaps>

    </SourceMap>

  </SourceMaps>

</DomainMap>


NPersist XML Mapping File Format, Detailed

DomainMap
Name The name of your domain map.
Source The name of the data source map you want to use as default.
RootNamespace The common root namespace for the classes in the domain.
IsReadOnly (Bool) Indicates if all classes in this domain map are read-only.
FieldPrefix The default prefix for the private field variables.
MergingBehavior The merging behavior to be used as default.
ClassMap
Name The name of the class.
Source The name of the data source that the class is mapping to. Leave empty to use default source.
Table The name of the table that the class is mapping to.
IsAbstract If true, indicates that the class can't be instantiated.
InheritanceType The pattern used for implementing an eventual inheritance hierarchy in the database.
IsReadOnly Indicates if the class map is read-only.
MergingBehavior The merging behavior to be used as default for the class.
IdentitySeparator The string used for separating the values of multiple identity properties.
InheritsClass The class (if any) that this class inherits from.
TypeColumn The name of the column containing the type discriminator for the class. Applies only to SingleTableInheritance. What is utility trim for vinyl siding, vinyl siding trim.
TypeValue The type discriminator value for the column specified as TypeColumn. Applies only to SingleTableInheritance.
PropertyMap
IsIdentity Indicates if the property is an identity property.
IdentityIndex Indicates the index of the identity property. Applies only when a class has multiple identity properties.
Name The name of the property.
DataType The data type of the property.
ItemType The data type of items in a collection property.
DefaultValue The default value for the property.
IsCollection Indicates if the property is a collection property (accepting multiple values).
Accessibility The accessibility for the property.
FieldAccessibility The accessibility for the private field that the property is mapping to.
FieldName The name of the private field that the property is mapping to. If you leave blank, the name of the property will be used, prefixed by the standard field prefix specified in the domain map. donation israel
ReferenceType The type of reference that this property is part of: ManyOne, OneMany, ManyMany or OneOne.
Inverse The name of this property's inverse property. Applies only to bi-directional reference properties.
NoInverseManagement Indicates if standard inverse managment should be applied.
InheritInverseMappings Indicates if this property should inherit its mapping settings from its inverse property.
Source The name of the data source that the property is mapping to. Leave empty to use the source specified in the class map. payday loans online
Table The name of the table that the property is mapping to. Leave empty to use the table specified in the class map.
Column The name of the column that the property is mapping to.
IdColumn The name of the identity column that the property uses to find values belonging to it. Applies only to collection properties and non-primary properties.
AdditionalColumns List of the names of any additional columns that this property is mapping to.
AdditionalIdColumns List of the names of any additional identity columns that this property is mapping to.
LazyLoad Indicates if this property should be lazy loaded.
IsReadOnly Indicates if this property is read-only.
NullValueSubstitute The value that should be used as substitute for Null values in the database.
CascadingCreate Indicates if the cascading create feature should be used for this property.
CascadingDelete Indicates if the cascading delete feature should be used for this property.
SourceMap
Name The name of the data source.
SourceType The type of the data source (MS Sql Server, MSAccess, Oracle, etc..)
ProviderType The provider that should be used for communication with the data source.
ConnectionString The connection string/DNS to the data source.
Schema The name of the data source schema (normally "dbo").
Catalog The name of the data source catalog.
TableMap
Name The name of the table.
ColumnMap
Name The name of the column.
DataType The data type of the column.
Length The length (in bytes) of the column.
IsAutoIncrease Indicates if the column is an auto-increasing column.
Format The format that should be used for values to the column. Applies only to date/time columns.
AllowNulls (Bool) Indicates if the column accepts Null values.
IsPrimaryKey Indicates if the column is part of the primary key for the table.
IsForeignKey Indicates if the column is part of a foreign key.
Increment The increment for the column. Aplies only to auto-increasing columns.
Seed The seed value for the column. Aplies only to auto-increasing columns.
DefaultValue The default value for the column.
Precision The precision of the column.
Scale The scale of the column.
PrimaryKeyColumn The name of the primary key column that this column is mapping to. Applies only to foreign key columns.
PrimaryKeyTable The name of the table with the primary key column that this column is mapping to. Applies only to foreign key columns.
IsFixedLength Indicates if the column is of fixed length. Applies only to Binary columns.
Sequence The name of an eventual sequence that this column may be mapped to.