TechTalk Genome v4.2

<LoadAlso> Element

Specifies the set of properties to retrieve from the database together with the accessed property if it is not yet loaded up.

<Member name=" property "
LoadAlso="(view|property-to-load|default|full)"
/>

or

<Member name=" property "
<LoadAlso>
<View>(view|property-to-load|default)</View>
<View>(view|property-to-load|default)</View>
...
</LoadAlso>
/>
property
A persistent property that is mapped using one of the field mappings.
view
A view within the type.
property-to-load
A persistent property of type.

Remarks

<LoadAlso> element specifies the set of properties to retrieve from the database together with the property if property is accessed but not loaded up yet. The property set can be specified as the union of one or more view or property-to-load.

Not specifying the <LoadAlso> element for a property is equivalent to specifying the full view, i.e. all properties are loaded up.

The properties default view is always implicitly added to the specified property set, therefore specifying the default in the <LoadAlso> element can only be used to change the default behaviour.

Regardless of the specified property set, properties that are already loaded up to the Context are not queried again.

Examples

          
BusinessContact.cs
                
public abstract class BusinessContact : Persistent {
    public abstract int Id { get; set }
    
    public abstract string FirstName { get; set; }
    public abstract string LastName { get; set; }
    public abstract string Position { get; set; }
    
    public abstract string CompanyName { get; set }
    public abstract string CompanyAddress { get; set }
    ...
}
                
          
NorthwindSchema.xml    
                
<Mapping xmlns="urn:TechTalk:TT.OODAL.XmlMapping">
    ...

    <Type name="BusinessContact">
        <RootInheritance />

        <View name="default">
            <Member>FirstName</Member>
            <Member>LastName</Member>
        </View>

        <View name="ContactPersonData">
            <Member>FirstName</Member>
            <Member>LastName</Member>
            <Member>Position</Member>
        </View>

        <View name="CompanyData">
            <Member>CompanyName</Member>
            <Member>CompanyAddress</Member>
        </View>
        
        <Member name="FirstName"><PersistentField /></Member>
        <Member name="LastName"><PersistentField /></Member>
        <Member name="Position"><PersistentField /></Member>
        
        <Member name="CompanyName" LoadAlso="CompanyData"><PersistentField /></Member>
        <Member name="CompanyAddress">
            <PersistentField />
            <LoadAlso>
                <View>CompanyName</View>
                <View>ContactPersonData</View>
            </LoadAlso>
        </Member>
    </Type>
    
</Mapping>
                

Requirements

Type: TechTalk.Genome.Mapping.LoadAlsoXmlData

Assembly: TechTalk.Genome.dll

Version: 4.2.11

Editions: Professional, Evaluation

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

See Also

<View> Element | Other Elements