Note that there are some explanatory texts on larger screens.

plurals
  1. PODo I need to implement INotifyPropertyChanged when using EF Code-First?
    primarykey
    data
    text
    <p>I'm noticing that when using EF CodeFirst, and binding my UI to an <code>ObservableCollection&lt;T&gt;</code> via the <a href="http://msdn.microsoft.com/en-us/library/gg696248%28v=vs.103%29.aspx" rel="nofollow"><code>DBSet.Local</code></a> property recommended <a href="http://msdn.microsoft.com/en-us/library/gg197521%28v=vs.103%29.aspx" rel="nofollow">here</a>, that the UI will update when entities are added to the DBContext but not when they are modified.</p> <p>It would seem that the <code>DBSet.Local</code> collection is not being notified that my entities have changed. When using EF Code-First do I need to implement <code>INotifyPropertyChanged</code> for all of my fields? I have not seen this in any of the examples on Code-First and it seems to go against the purpose, but perhaps I'm mistaken.</p> <p>I can post some example code if you feel that the <code>ObservableCollection</code> should be receiving change notifications and that something must be wrong in my Entity classes or something.</p> <p><strong>Edit</strong> So, just to be sure, if I have code like the following in my ViewModel</p> <pre><code>private ClientContext clientContext; private Client client; public Client Client { get { return client; } set { client = value; NotifyOfPropertyChange(() =&gt; Client); NotifyOfPropertyChange(() =&gt; Clients); } } public ObservableCollection&lt;Client&gt; Clients { get { return clientContext.Clients.Local; }} </code></pre> <p>Let's also assume my View has a Listbox with Itemssource set to Clients, and SelectedItem set to Client. I still need to implement INotifyPropertyChanged in my Model, even though I'm using it in my ViewModel?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    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