New Posts New Posts RSS Feed: receive notification changes of properties and one- and many-end of navigation properties
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

receive notification changes of properties and one- and many-end of navigation properties

 Post Reply Post Reply
Author
leeatkinson View Drop Down
Newbie
Newbie


Joined: 01-Jul-2010
Posts: 17
Post Options Post Options   Quote leeatkinson Quote  Post ReplyReply Direct Link To This Post Topic: receive notification changes of properties and one- and many-end of navigation properties
    Posted: 03-Aug-2010 at 6:33am
Hi

I have a couple of questions:

1) I want to be notified when the user changes the value of a scalar property. I have implemented a property interceptor for its set - but I wonder if this the best, or should I use OnPropertyChanged?

2) I also need to be notified when the user adds an entity to the many-end of a navigation property - e.g. when an order line is added to an order, the order is notified either if the user calls myOrder.Lines.Add(myOrderLine) or myOrderLine.Order = myOrder. What is the best solution for this?

Thanks

Lee
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 05-Aug-2010 at 6:37pm
  1. You can simply subscribe to the PropertyChanged event of an entity to be notified when the value of one of its scalar properties is changed.

  2. You can subscribe to the PropertyChanged event on the collection property; e.g.,
          
aCustomer.Orders.PropertyChanged += new PropertyChangedEventHandler(Orders_PropertyChanged);

          It will report changes in the list's Count and Items[] properties when an item is added to the collection.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down