locked
Changing the type of collection navigation properties to ObservableCollection RRS feed

  • Question

  • Hi,

    I am using Entity Framework 4.1, Database first and the DbContext API

    I noticed that collection navigation properties of the entities generated with the DbContext T4 template are declared as ICollection.

    To fully use the binding support of WPF I changed the type from ICollection to ObservableCollection. This works great.

    My question is: Are there any consequences from this change that I need to know of?

    Thanks,

    Michel Miranda

    Friday, August 12, 2011 10:35 AM

Answers

  • Hi Michel,

    Welcome!

    As far as I know, I don't think there are any consequences from this change. Let's see the definition of ObservableCollection. It inherits from Collection<T>, INotifyCollectionChanged, INotifyPropertyChanged

    Have a nice day. 


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, August 15, 2011 4:02 AM

All replies

  • Hi Michel,

    Welcome!

    As far as I know, I don't think there are any consequences from this change. Let's see the definition of ObservableCollection. It inherits from Collection<T>, INotifyCollectionChanged, INotifyPropertyChanged

    Have a nice day. 


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, August 15, 2011 4:02 AM
  • Hi Alan,

    Of course! Thank you for your help!

    Michel Miranda

    Monday, August 15, 2011 5:52 AM