TechTalk Genome v4.2

<Member> Element

Defines how a member is translated to the underlying relational database system.

<Type name=" type ">
<Member name=" member " [signature="param-type1, ..., param-typen"] [mapping-specification] [modifiers] >
[mapping-specification]
[modifiers]
</Member>
</Type>
type
A class name.
member
A name specifying a method or property on the type.
param-type1...param-typen
A list of types separated by commas, specifying the parameter list of member. If the member is a property or a method with no parameters, the parameter list can be omitted.
mapping-specification
One of the field mappings or member mappings providing the translation of the member to the underlying relational database system.
modifiers
One or more member modifier elements that can extend the functionality of the member.

Remarks

The <Member> element can be used to define the representation of a method or property in the underlying relational database system. If the member is a method, its parameter list specifies the overload to be mapped. Providing modifiers, the element can also be used to change and extend member functionality.

The mapping-specification and modifiers can either be represented as XML attributes (if the feature supports attribute representation) or as sub-elements.

Examples

<Mapping xmlns="urn:TechTalk:TT.OODAL.XmlMapping">
    ...
    
    <Type name="Employee">

        <!-- the FirstName property is mapped to a database field strFirstName -->
        <Member name="FirstName">
            <PersistentField fieldName="strFirstName" />
        </Member>

        <!-- the LastName property is mapped to a database field strLastName -->
        <Member name="LastName" PersistentField="strLastName" />

    </Type>
</Mapping>

In this example, the CalcSum method of the Order class is mapped as an OQL expression that calculates the sum price of the order items, taking into account a specified discount and shipping costs.

          
Order.cs
                    
public abstract class Order : Persistent {
    ...
    public abstract double GetTotalPrice();
    public abstract double CalcSum(double discount, int shippingCost);
}
                    
          
NorthwindSchema.xml    
                    
<Mapping xmlns="urn:TechTalk:TT.OODAL.XmlMapping">
    <Type name="Order">
        <Member name="GetTotalPrice"
            Oql="Sql.Sum([UnitPrice * Quantity]extentof(OrderDetails)[od: od.Order == this])" />
            
        <Member name="CalcSum" signature="double, int" 
            Oql="(1 - discount) * GetTotalPrice() + shippingCost" />
    </Type>
</Mapping>
                

Requirements

Type: TechTalk.Genome.Schema.Builder.Xml.MemberXmlData

Assembly: TechTalk.Genome.dll

Version: 4.2.4

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> Element | <DefineProperty> Element | <DefineMethod> Element | Field Mappings | Member Mappings | Other Elements