On a DetailView I have a PopupShowWindowAction handled in a View Controller
* The PopupShowWindowAction opens a Detail View of a "MaterialChooser" object for the user to select a Material
* In the PopupShowWindowAction Execute event this Material is used to change the objects in the Detail View's nested List View
All works fine… Except - when opening a Detail View of an object in the nested ListView this exception occurs:
C#Persistent-specific operation is performed with a non-persistent class 'Firebelly.Module.Fabrication.MaterialChooser'
The "MaterialChooser" class is indeed marked as NonPersistent and inherits from a persistent class "Material" which has [Rule] attributes
I am guessing this means that something - Session? - is holding a reference to the PopupShowWindowAction's MaterialChooser?
Why is the reference held?
How can I avoid this exception?
Hello Andrew.
The information you provided is insufficient to diagnose this issue or suggest any workaround. Please provide us with a small sample project demonstrating the issue and the exception call stack.
Hi MichaelI can't make a "small sample" project - cutting down the application is too hard.I have attached the log file.
According to the call stack, it seems that the collection corresponding to the nested list view from which you open a detail view is aggregated, so XAF creates a nested object space for the popup detail view. However, non-persistent properties cannot be transferred to the nested object space, and an exception is thrown. I'm afraid I cannot suggest a solution without knowing your data model and requirement details. If you cannot provide your entire project, try to create a small sample demonstrating a similar situation.
Hi MichaelI think the issue may arise because the non-Persistent object is the object for the PopupShowAction View AND it was created in the View Controller's ObjectSpaceI have amended the CustomizePopupWindowParams event handler to use an Application created ObejctSpace for the object and for its associated PopupShowAction View.Some of the PopupShowAction object's reference properties are used to populate the View Controller's Current Object - so I use ObjectSpace.GetObect() to get the PopupShowAction object into the VIew's ObjectSpaceIn testing so far this seems to have resolve the issue…
I'm glad to hear that you've found a solution. Details of your solution are still unclear to me, though. Should you need any furhter assistance, provide your controller and business object code, at least.
The solution detail is quite simple and fairly common in UI's* An Estimate is for 1 or more Products each made from some Material* To change the Material for a Product the user clicks on a a PopupShowAction* In the modal DetailView the user chooses a Material, and clicks on "OK"* The View Controller then determines whether it is possible to use the Material for Product* If it IS possible the View Controller sets the Material for the Product to the chosen Material* If NOT possible - the View Controller displays a message explaining why notThis involves collaboration via the View Controller between the chosen Material and the Product.I get the ticketed issue If the PopupShowAction Material & the Estimate's Product are in the same ObjectSpace when the Product's Material is changed
Thank you for your reply. I hope the solution you've found works for you. Should you need any further assistance, please let me know.
Hi MichaelI the used the MaterialChooser class in another view and got a similar problem…So -I have made the MaterialChooser class Peristent - but don't Save on Accept This works better - and the only cost is an empty table in the database
If you need any additional assistance, please provide us with a small sample project demonstrating your scenario, because details of your implementation are still unclear.