Early binding of referenced objects #41

Closed
hisystems opened this Issue Mar 25, 2012 · 1 comment

Projects

None yet

1 participant

@hisystems
Owner

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.

@hisystems hisystems was assigned Mar 25, 2012
@hisystems
Owner

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.

@hisystems hisystems added a commit that closed this issue Apr 10, 2012
@hisystems Added support for early binding object references. Closes #41.
Utilises the DatabaseObjects.Generic.ObjectReference class in conjunction with the ObjectReferenceEarlyBindingAttribute to indicate that the foreign object should be loaded using a table join and loaded with the containing / referencing object. This avoids having to specify table joins as this is done automatically.
ea8b776
@hisystems hisystems closed this in ea8b776 Apr 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment