Change Notification in EF EntityCollection

In Silverlight 4 proj, I use WCF RIA services, the principles of MVVM and EF 4. I encounter this situation: I created an object called Category and another called CategoryLocale (automated using VS, without POCO). The ratio between them is from 1 to N (one category can have many categories), therefore, through this relationship, you can implement master part scenarios.

Every time I change a property in the master record (Category), I get a notifypropertychanged notification. But: whenever I change a property in detail (CategoryLocales), I get nothing.

The detail is tied to the Datagrid as follows:

<sdk:DataGrid Grid.Row="3" Grid.ColumnSpan="2" ItemsSource="{Binding SelectedRecord.CategoryLocales,Mode=TwoWay}" AutoGenerateColumns="False" VerticalScrollBarVisibility="Auto" > 

Any help is appreciated!

Thanks in advance

+4
source share
1 answer

It turns out very simple as soon as you read the documents!

The solution is to mark the relationship between the main and detailed objects with the Composition attribute. Once this has been done, these objects of the main part are viewed as a whole, therefore, every time a change occurs in the main entity or in any of the detailed objects, there is a notification of the change.

For those who want to read more in the future, click here !

+2
source

Source: https://habr.com/ru/post/1309130/


All Articles