/// <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> /// 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 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(); } }
/// <summary> /// Gets the collection of business objects from the specified relationship member. /// </summary> /// <param name="entity"></param> /// <param name="member">The relationship member.</param> /// <param name="listPropertyName">The property name.</param> /// <returns>A collection of business objects which represent the /// relationship defined by the specified relationship member.</returns> protected IList GetList(Object entity, EntityRelationshipMember member, String listPropertyName) { IList list; if (member != null && member.HasDataSource) { // get list from data source list = member.GetEntityList(); } else { // get list from DeepLoaded entity list = EntityUtil.GetEntityList(entity, listPropertyName); } return(list); }
/// <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> /// 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> /// 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> private void Insert(EntityRelationshipMember member, IList links, IDictionary values) { Insert(member, links, values, false); }
/// <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(); } }
/// <summary> /// Gets the collection of business objects from the specified relationship member. /// </summary> /// <param name="entity"></param> /// <param name="member">The relationship member.</param> /// <param name="listPropertyName">The property name.</param> /// <returns>A collection of business objects which represent the /// relationship defined by the specified relationship member.</returns> protected IList GetList(Object entity, EntityRelationshipMember member, String listPropertyName) { IList list; if ( member != null && member.HasDataSource ) { // get list from data source list = member.GetEntityList(); } else { // get list from DeepLoaded entity list = EntityUtil.GetEntityList(entity, listPropertyName); } return list; }