From Rockford Lhotka's Expert C# 2008 and VB 2008 Business Objects books
Vinodonly:My question is which methods I should call from these buttons BindingList.AddNew and BindingList.Remove. Or I should change the scope of factory methods from Internal to Public and call this from UI.
For an add button I'll typically call the AddNew() method on the collection to get the same behavior I'd have gotten from a datagrid.
For a remove button I'll typically call RemoveAt() on the collection (or Remove() - depending on how I know which item to remove).
Vinodonly: 2. I read in book that CSLA extends the behaviour of BindingList by adding new features and some fixes. One of the fix is Providing a event before Item is removed. Is there any example where it is shown how this is used so that things can be little bit more clear.
2. I read in book that CSLA extends the behaviour of BindingList by adding new features and some fixes. One of the fix is Providing a event before Item is removed. Is there any example where it is shown how this is used so that things can be little bit more clear.
This is covered in the CSLA .NET Version 2.1 Handbook.
Vinodonly: 3. Although this feature is added for collections but is there a similar feature for BusinessBase bcos there also this event is missing.
3. Although this feature is added for collections but is there a similar feature for BusinessBase bcos there also this event is missing.
There is no formal concept of "remove" from an object. If you add code to your business object to allow a "remove" of a child object, you can easily add your own Removing and Removed events when you add your Remove() method.
Vinodonly: 4. Can FeildManger be used from GrandChild to access properties of Parent object
4. Can FeildManger be used from GrandChild to access properties of Parent object
No. FieldManager is not designed to break encapsulation. My goal was not to make it easy to cheat and allow one object to access the fields of another object (other than with an ObjectFactory - which is certainly cheating...).
Whatever technique you would have used before FieldManager to allow one object to access the properties of another object is the same technique you should use now.
Rocky