Hi,
I have a data portal factory with a block of code
public object Update(BusinessBaseList ol)
{
foreach(BusinessBase o in ol.DeletedList)
{
Delete<Object>(o);
}
}
This used to work, but now I am getting errors around deletedlist that it "cannot be used in this context because the get accessor is inaccessible" and that "DeletedList is inaccessible due to its protection level"
In the previous CSLA version, it appears that the BusinessListBase.DeletedList was public, but now it is protected. However, there is strong evidence that the version of CSLA I upgraded from (4.0.0-100201 - a pre release version anyway) had been tampered with so I am not sure if my initial approach was valid to begin with.
With the latest version, what is the proper approach to iterating through a deletedlist and deleting the objects within it?
Thanks
I don't recall DeletedList being protected.. but regardless of whether its changed or not...
If something is in DeletedList, it's Child_DeleteSelf should be called, and so you should bel able to do whatever deleting you require in there. You shouldn't need to do anything, it should just work as this is standard behavior for items in the deleted list.
Okay, something really odd is happening here. I've unloaded and reloaded the CSLA project into my solution, and the method is definitely protected, but when I open the class using notepad, the method shows as public.
What the hey?
I'm obviously doing something wrong, but all I am doing is right-clicking on my solution, adding an existing project and selecting the CSLASource-401-100828\source\Csla\Csla.csproj file. Visual studio appears to be making it protected for some reason.
I'm really confused right now :/
Edit - Ignore the above, I suspect user error. I've reinstalled CSLA with a fresh copy of the latest version, and the method in the source is definitely protected. So I am still with my original problem, that I cannot access the DeletedList method with my current approach, so I can't see what is in the deletedlist to actually delete.
You may want to use
object IEditableCollection.GetDeletedList();
Regards,
Mario
DeletedList is protected. So are all the metastate properties of objects (IsNew, etc).
The ObjectFactory base class has methods that allow you to access and manipulate these protected members, including DeletedList.
Your factory object should subclass ObjectFactory to use these features.
Copyright (c) Marimer LLC