Few questions related with CSLA 3.6.3Few questions related with CSLA 3.6.3
Old forum URL: forums.lhotka.net/forums/t/7215.aspx
Vinodonly posted on Thursday, July 02, 2009
Although the new book cleared lot of doubts but still I have few questions..
1. For child collections, I want to use normal controls instead of Grid. Currently I have implemented AddNewCore so items can be added when user presses down arrow in grid. But now bcos grid is not there I will put two buttons for Insert and Deletion (for child objects) with a list control showing the complete collection.
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.
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.
3. Although this feature is added for collections but is there a similar feature for BusinessBase bcos there also this event is missing.
4. Can FeildManger be used from GrandChild to access properties of Parent object RockfordLhotka replied on Thursday, July 02, 2009
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.
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.
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
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.
Vinodonly replied on Thursday, July 02, 2009
Thanks for detailed replies. I have few more queries
1. Are there any possibilities of adding pre-remove event in Businessbase also, that way it will be similar to the behaviour providded by businesslistbase.
2. In ProjectResource->GetResource method, we are checking this before with CanExecuite method. What I understand is that all the these checks are already done by CSLA bcos of this we are not putting any of the checking code in our factory methods, then why we have to specifically call this method in this case.
Copyright (c) Marimer LLC