Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Early binding of referenced objects #41
Currently, late binding of referenced objects is supported via the ObjectReference class. This is assigned the foreign table's distinct field when the referencing object is loaded. On the first call to ObjectReference.Object the object is loaded and on subsequent calls the already loaded object is returned. Early binding of objects is supported via the IDatabaseObjects.TableJoins function which causes the database record and the referenced record to be loaded into one record. This record is then used to load the object and the referenced object in one operation rather than via multiple calls to the database. However, this requires overriding the IDatabaseObject.LoadFields function and using the Database.ObjectLoad, which is not a particularly succinct solution.
Utilise the existing ObjectReference class but specify an attribute that indicates whether early or late binding should be utilised: ObjectReferenceLoadAttribute(Early / Late). When an object is using early binding the appropriate table joins should be automatically created and the referenced object loaded and assigned to the ObjectReference.Object property.