Specifies how Genome should map enumeration values to the database.
This feature modifies the mapping of the enumType globally in the whole schema, meaning that all enumType fields of the business classes that are mapped as PersistentField are affected.
For each the enumeration value of enumType, there should be exactly one <Value .../> element defined. Also, all the mapped database values (db-value1, db-value2, ...) should be different.
Mapping the values of the Color class
public enum Color
{
Red,
Green,
Blue,
Black
}
as varchar(2), with the values "R", "G", "B" and "BK" 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="Color">
<EnumMapping baseType="string" Unicode="false" VariableLength="true" Length="2">
<Value enumValue="Red" dbValue="R" />
<Value enumValue="Green" dbValue="G" />
<Value enumValue="Blue" dbValue="B" />
<Value enumValue="Black" dbValue="BK" />
</EnumMapping>
</Type>
</Mapping>