/// <summary> /// Updates the specified business object with the specified name/value pairs. /// </summary> /// <param name="member">The relationship member.</param> /// <param name="link">The business object to update.</param> /// <param name="values">A collection of name/value pairs to insert.</param> private void Update(EntityRelationshipMember member, Object link, IDictionary values) { if ( member != null && member.HasDataSource ) { member.GetLinkedDataSource().Update(link, values); } else { EntityUtil.SetEntityValues(link, values); } }
/// <summary> /// Inserts the specified name/value pairs into the /// relationship defined by the specified member. /// </summary> /// <param name="member">The relationship member.</param> /// <param name="links">A collection of business objects.</param> /// <param name="values">A collection of name/value pairs to insert.</param> /// <param name="initEntityKey">A value indicating whether or not to initialize the /// business object's unique identifier property before executing the insert operation.</param> private void Insert(EntityRelationshipMember member, IList links, IDictionary values, bool initEntityKey) { if ( member != null && member.HasDataSource ) { member.GetLinkedDataSource().Insert(values); } else { Object link = EntityUtil.GetNewEntity(member.EntityType); EntityUtil.SetEntityValues(link, values); if ( initEntityKey ) { EntityUtil.SetEntityKeyValue(link, member.EntityKeyName); } EntityUtil.Add(links, link); } }
/// <summary> /// Removes the specified item from the collection of business objects. /// </summary> /// <param name="member">The relationship member.</param> /// <param name="links">A collection of business objects.</param> /// <param name="link">The item to remove.</param> private void Remove(EntityRelationshipMember member, IList links, Object link) { EntityUtil.Remove(links, link); if ( member != null && member.HasDataSource ) { member.GetLinkedDataSource().Delete(link); } }
/// <summary> /// Inserts any previously cached business object references. /// </summary> /// <param name="member">The relationship member.</param> private void Insert(EntityRelationshipMember member) { if ( member != null && member.HasDataSource ) { Object entityKeyValue = PrimaryMember.GetEntityId(); foreach ( IDictionary values in member.Inserts ) { values[member.EntityKeyName] = entityKeyValue; member.GetLinkedDataSource().Insert(values); } member.Inserts.Clear(); } }