TechTalk Genome v4.2

<Discriminator> Element

Specifies the discriminator values associated with a type in a type family that has TypeDiscriminator type identity. One or more discriminator values can identify the same type.

<Type name=" type ">
<Discriminator value=" discriminator-value " />
</Type>

or

<Type name=" type ">
<Discriminator>
(<Value>discriminator-value</Value>)+
</Discriminator>
</Type>
type
A class specifying a non-abstract persistent type.
discriminator-value
A constant value that is convertible to the type of the discriminator property specified for the TypeDiscriminator, or a name of an enumeration value if the discriminator property is an enum type.

Remarks

The <Discriminator> element can be used to specify the discriminator values that determine the dynamic type of instances of the type by associating the discriminator-values to the type. The values have to be unique within the type family. Assigning a discriminator-value to more than one type in the type family of type is invalid.

discriminator-value can be any literal which can be converted to the type of the discriminator property by using the Convert.ChangeType method. No quotation is needed for string values. If the type of discriminator property is an enum type, the identifier of the enum values can be used to specify the discriminator-value.

Examples

Specifies the type discriminator as an integer.

                    
<Type name="Employee">
    <TypeDiscriminator memberName="TypeId" />
    <Discriminator value="0" />
    ...
</Type>
                

Specifies the type discriminator as an enum value.

                    
<Type name="Employee">
    <TypeDiscriminator memberName="TypeId" />
    <Discriminator value="Employee" />
    ...
</Type>
                

Specifies more type discriminator values for the type. Here both 0 and 2 refer to the instances of type Employee.

                    
<Type name="Employee">
    <TypeDiscriminator memberName="TypeId" />
    <Discriminator>
        <Value>0</Value>
        <Value>2</Value>
    </Discriminator>
    ...
</Type>
                

Requirements

Type: TechTalk.Genome.Mapping.DiscriminatorXmlData

Assembly: TechTalk.Genome.dll

Version: 4.2.11

Editions: Professional, Evaluation, Express

Database Platforms: Microsoft SQL Server 2000, Microsoft SQL Server 2005, Oracle 9i Release 2, Oracle 10g Release 2

See Also

Type Identity Providers | <TypeDiscriminator> Element