KREDOR Business Object Framework Documentation

BusinessObject.OnLoad Method 

Overriden in derived classes. Automatically called when an object is loaded from the database, in order to load any contained objects and collections.

protected internal abstract void OnLoad();

Return Value

Remarks

Compound objects (objects that contain other entity objects or collections of entity objects) must implement in this method the code necessary to initialize/load these contained objects.

Exceptions

Exception Type Condition
BOException  

Example

A sample implementation of OnLoad() in a derived class Account that loads into the private field _charges of type ArrayList the charges from the past six months.

public class Account
{
    private int _accountID; // Primary Key
    private string _name;
    private string _createDate;
    private ArrayList _charges;
    
    ... // contructors
    
    protected override void OnLoad()
    {
        _charges = SelectFrom.From(typeof(Charge))
                             .Where("AccountID", Op.Equals, this._accountID).Or("CrDate", Op.GreaterThan, DateTime.Today.AddMonths(-6))
                             .Where(Obj.AccountID == this._accountID & Obj.CrDate > DateTime.Today.AddMonths(-6))
                             .Select();
    }
}

See Also

BusinessObject Class | Kredor.BO Namespace