TechTalk Genome v4.2

Database Type Modifiers

The mapping of scalar types to database types in the underlying relational database system can be influenced by using the database type modifier attributes. The attributes can be used for the following types:


The following example illustrates how to use database type modifiers to define the type of a persistent field in the database.

public abstract class Employee : Persistent {
    public abstract string FirstName { get; set; }
    public abstract DateTime BirthDate { get; set; }
    public abstract string HomePhone { get; set; }
<Mapping xmlns="urn:TechTalk:TT.OODAL.XmlMapping">

    <Type name="Employee">
        <!-- FirstName will be stored in the "FirstName nvarchar(255)" field -->
        <Member name="FirstName">
            <PersistentField />
        <!-- BirthDate will be stored in the "dtBirthDate datetime" field -->
        <Member name="BirthDate" PersistentField="dtBirthDate" />   

        <!-- HomePhone will be stored in the "strPhone varchar(24)" field -->
        <Member name="HomePhone">
            <PersistentField fieldName="strPhone" Length="24" Unicode="false" />


See Also

XmlMapping.Elements.PersistentField | <StoredFunction> Element