/// <summary> /// Modifies the collection of related entities for a specific relationship. /// </summary> /// <typeparam name="TEntity"></typeparam> /// <param name="propertyName"></param> /// <param name="relationshipSchemaName"></param> /// <param name="primaryEntityRole"></param> /// <param name="entities"></param> /// <remarks> /// Raises the property change events. /// </remarks> protected virtual void SetRelatedEntities <TEntity>(string propertyName, string relationshipSchemaName, EntityRole?primaryEntityRole, IEnumerable <TEntity> entities) where TEntity : Entity { propertyName.ThrowOnNullOrWhitespace("propertyName"); relationshipSchemaName.ThrowOnNullOrWhitespace("relationshipSchemaName"); // check that the new value is different from the current value // TODO: perform comparison RaisePropertyChanging(propertyName); EntityExtensions.SetRelatedEntities(this, relationshipSchemaName, primaryEntityRole, entities); RaisePropertyChanged(propertyName); }
/// <summary> /// Modifies the value of an attribute. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="propertyName"></param> /// <param name="attributeLogicalName"></param> /// <param name="entityLogicalName"></param> /// <param name="value"></param> /// <remarks> /// Raises the property change events. /// </remarks> protected virtual void SetAttributeValue <T>(string propertyName, string attributeLogicalName, string entityLogicalName, object value) { propertyName.ThrowOnNullOrWhitespace("propertyName"); attributeLogicalName.ThrowOnNullOrWhitespace("attributeLogicalName"); // check that the new value is different from the current value if (Equals(GetAttributeValue <object>(attributeLogicalName), value)) { return; } RaisePropertyChanging(propertyName); EntityExtensions.SetAttributeValue <T>(this, attributeLogicalName, entityLogicalName, value); RaisePropertyChanged(propertyName); }
/// <summary> /// Retrieves the value of a sequence attribute. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="attributeLogicalName"></param> /// <returns></returns> public virtual IEnumerable <T> GetAttributeCollectionValue <T>(string attributeLogicalName) where T : Entity { return(EntityExtensions.GetAttributeCollectionValue <T>(this, attributeLogicalName)); }
/// <summary> /// Retrieves the value of an attribute. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="attributeLogicalName"></param> /// <returns></returns> public override T GetAttributeValue <T>(string attributeLogicalName) { return(EntityExtensions.GetAttributeValue <T>(this, attributeLogicalName)); }