Note that there are some explanatory texts on larger screens.

plurals
  1. POObservableCollection<EF4Entity> bound to ListView, but relation fields don't cause ListView to update
    primarykey
    data
    text
    <p>I have an <code>ObservableCollection</code> of Entity Framework 4 entities bound to a <code>ListView</code>. If I modify any of the normal, scalar properties of the entity, the values displayed in the <code>ListView</code> are updated.</p> <p>Any relationship (navigation) properties are not updated in the <code>ListView</code> if they change, because the entity object doesn't implement change notifications for these properties.</p> <p>Right now, I'm removing the entity from the collection and then reinserting it back into the same position to force the <code>ListView</code> to update.</p> <p>There must be a better solution. What is it, if it exists?</p> <p>Here's the generated code from VS2010's EF designer:</p> <pre><code>[EdmEntityTypeAttribute(NamespaceName="RovingAuditDb", Name="AuditRecord")] [Serializable()] [DataContractAttribute(IsReference=true)] public partial class AuditRecord : EntityObject { #region Factory Method /// &lt;summary&gt; /// Create a new AuditRecord object. /// &lt;/summary&gt; /// &lt;param name="id"&gt;Initial value of the Id property.&lt;/param&gt; /// &lt;param name="date"&gt;Initial value of the Date property.&lt;/param&gt; public static AuditRecord CreateAuditRecord(global::System.Int32 id, global::System.DateTime date) { AuditRecord auditRecord = new AuditRecord(); auditRecord.Id = id; auditRecord.Date = date; return auditRecord; } #endregion #region Primitive Properties // Deleted for this post #endregion #region Navigation Properties /// &lt;summary&gt; /// No Metadata Documentation available. /// &lt;/summary&gt; [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("RovingAuditDb", "AuditRecordCell", "Cell")] public Cell Cell { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference&lt;Cell&gt;("RovingAuditDb.AuditRecordCell", "Cell").Value; } set { ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference&lt;Cell&gt;("RovingAuditDb.AuditRecordCell", "Cell").Value = value; } } /// &lt;summary&gt; /// No Metadata Documentation available. /// &lt;/summary&gt; [BrowsableAttribute(false)] [DataMemberAttribute()] public EntityReference&lt;Cell&gt; CellReference { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference&lt;Cell&gt;("RovingAuditDb.AuditRecordCell", "Cell"); } set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference&lt;Cell&gt;("RovingAuditDb.AuditRecordCell", "Cell", value); } } } // Rest of the Navigation properties removed for this post </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload