KREDOR Business Object Framework Documentation

OnAttribute Class

Specifies the ON clause linking a joined field with its parent object. When a parent object is loaded from the database all its joined fields and subfields are automatically loaded as well.

For a list of all members of this type, see OnAttribute Members.

System.Object
   Attribute
      OnAttribute

public class OnAttribute : Attribute

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

All joined properties/fields must be decorated with the OnAttribute. Joined properties/fields must be either of a type derived directly or indirectly from BusinessObject or of a type that implements the IList interface such ArrayList or List<T> where T is a type derived from BusinessObject.

Example

This sample shows a class with two joined fields.

[DataSource("MyDatabase")]
public class Account : BusinessObject
{
    private int _accountID;
    private string _name;
    private int _status;
    private DateTime _createDate;

    [On("accountid")]
    public Person _owner;
    
    [On("accountid", "account_id")]
    [Where("Status", Op.Equals, SubscriptionStatus.Active)]
    public List<Subscription> _subscriptions;
    
    public Account() : base ()
    {
    }

    protected override void OnLoad()
    {
    }
}

Requirements

Namespace: Kredor.BO

Assembly: KREDOR.BOFramework (in KREDOR.BOFramework.dll)

See Also

OnAttribute Members | Kredor.BO Namespace | FromAttribute | WhereAttribute | OrderByAttribute | SelectFrom