/// -------------------------------------------------------------------------------- /// <summary> /// Initializes an existing object with values from a set of database fields. /// Specifically, sets the IDatbaseObject.IsSaved property to true, /// sets the IDatbaseObject.DistinctValue using the provided data and /// calls IDatbaseObject.LoadFields(). /// </summary> /// /// <param name="objCollection"> /// The collection associated with the field values. This is not used /// to create an object - but to set the distinct field for the object using the /// IDatabaseObjects.DistinctFieldName property. /// </param> /// /// <param name="objFieldValues"> /// The data container that contains the data to be copied into the object. /// </param> /// -------------------------------------------------------------------------------- public static void ObjectLoad(IDatabaseObjects objCollection, IDatabaseObject objItem, SQL.SQLFieldValues objFieldValues) { if (objFieldValues == null) throw new ArgumentNullException(); objItem.IsSaved = true; objItem.DistinctValue = objFieldValues[objCollection.DistinctFieldName()].Value; objItem.LoadFields(objFieldValues); }