Defines how a member is translated to the underlying relational database system.
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.
<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>
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
<Type> Element | <DefineProperty> Element | <DefineMethod> Element | Field Mappings | Member Mappings | Other Elements