I've been under the impression that the way to handle adding new items to a collection in Csla is to override the AddNewCore method. However, poking around in the BindingList base class suggests that it may be more appropriate to override the OnAddingNew method, and set the NewObject field of the AddingNewEventArgs object to the newly created child object. Perhaps something like:
protected override void OnAddingNew(AddingNewEventArgs e){
base.OnAddingNew(e);
if (e.NewObject == null) e.NewObject = Child.New();
}
The AddNewCore base class method will raise the OnAddingNew event. If you override the OnAddingNew (or simple register for the event (e.g. in UI code)), and set the AddingNewEventsArg.NewObject property to the new child object (i.e. you create it using your static factory method), when AddNewCore finds that AddingNewEventArgs is not null, it will use this instead of trying to call the constructor.
Copyright (c) Marimer LLC