Overriding AddNewCore

Overriding AddNewCore

Old forum URL: forums.lhotka.net/forums/t/941.aspx


ajj3085 posted on Friday, August 18, 2006

Hi,

When you override AddNewCore, is anyone raising the AddingNew event? 

The docs say that raising the event allows listens to place a custom object in the collection, but it also seems likely that there may be those that want to listen to the event so that they are aware an item was added?

Should I be raising the event or not?

Andy

RockfordLhotka replied on Wednesday, August 23, 2006

That event comes from BindingSource, not from the data source object. So your business object should not raise this event, no.

ajj3085 replied on Wednesday, August 23, 2006

BindingSource?  Do you mean BindingList?  I'm confused... if I don't call OnAddingNew protected method, the AddingNew event never fires.  Should that be the case for Csla objects?

RockfordLhotka replied on Wednesday, August 23, 2006

What object raises AddingNew? It is my understanding that the BindingSource control raises an AddingNew method, not the data source object (like a BindingList<T>). There's no AddingNew event defined in any of the data source interfaces like IBindingList (that I'm aware of at least).
 
Rocky


From: ajj3085 [mailto:cslanet@lhotka.net]
Sent: Wednesday, August 23, 2006 8:51 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Overriding AddNewCore

BindingSource?  Do you mean BindingList?  I'm confused... if I don't call OnAddingNew protected method, the AddingNew event never fires.  Should that be the case for Csla objects?



ajj3085 replied on Wednesday, August 23, 2006

BindingList<T> defines an AddingNew event.  The default implemention of AddNewCore will raise this event as well by calling the OnAddingNew( AddingNewEventArgs ) method. 


RockfordLhotka replied on Wednesday, August 23, 2006

Huh, well there you go then :)
 
I should think that you'd want to raise that event then.


From: ajj3085 [mailto:cslanet@lhotka.net]
Sent: Wednesday, August 23, 2006 9:23 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] RE: Overriding AddNewCore

BindingList<T> defines an AddingNew event.  The default implemention of AddNewCore will raise this event as well by calling the OnAddingNew( AddingNewEventArgs ) method. 





Copyright (c) Marimer LLC