TechTalk Genome v4.2

<BoolMapping> Element

Specifies how Genome should map Boolean values to the database.

<Type name="bool">
<BoolMapping baseType=" clr-type " [database-type-modifiers] >
<True dbValue="db-true-value">
<False dbValue="db-false-value">
</BoolMapping>
</Type>
clr-type
The type of the values specified as db-*-value.
database-type-modifiers
An optional list of database type modifiers that change the type of the database field. The default mapping for the type of clr-type is used if no modifier is specified. The defaults can be found in the description of Database Type Modifiers.
db-true-value, db-false-value
The values stored in the database that represent the client side true and false values respectively.

Remarks

This feature modifies the mapping of bool globally in the whole schema, meaning that all bool fields of the business classes that are mapped as PersistentField will be affected.

The db-true-value and db-false-value should differ.

Examples

Mapping all boolean persistent fields of the business classes as char(1) with the values 'Y' and 'N' respectively:

                    
<?xml version="1.0" ?>

<Mapping xmlns="urn:TechTalk:TT.OODAL.XmlMapping">
  <Using namespace="System" />
  <Using namespace="TechTalk.Genome" />
  <Using namespace="TechTalk.Genome.Mapping" />
  <Using namespace="TechTalk.Genome.Schema.Builder.Xml" />
 
  <Using namespace="MyBusiness" />
 
  <Type name="bool">
    <BoolMapping baseType="char" Unicode="false">
      <True dbValue="Y" />
      <False dbValue="N" />
    </BoolMapping>
  </Type>
</Mapping>
                

See Also

Other Elements