Csla6 BusinessBindingListBase EFCore Save() #3276
-
We have a Csla business library with about fifty classes, mostly based on SwitchableObject, that we have been using for some years. The technology is Csla 4.51, .Net Framework 4.8, and ADO.Net. We are in the process of creating a Blazor Server app, and need to upgrade to Csla 6.2.2, .Net6, and EFCore, using Dependency Injection. From various sources I have pieced together a fully-working switchable object class based on BusinessBase, and a partly functional collection class based on BusinessBindingListBase. The CreateChild and FetchChild appear to be working correctly, but I have been unable to find a sample of UpdateChild to crib from. When I execute this code:
Everything works correctly until the 'Save'. UpdateChild in my collection class, POSList, is never touched, and instead I receive an error message "Can not directly save a child object". However, it's the collection I'm trying to save, not an individual object. This is my collection class:
And these are the child functions in the single-object POS class:
Except for the added 'Child' on the attributes and the added 'object Parent' in the signatures, these are identical to the non-child functions that are working correctly. So, my questions are:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
What is the type of your Update: actually it looks like you create the list as a child by calling At some point you must use the root data portal to get the top-level root object, and that is the option that you need to save. You can't directly save an object that you created via |
Beta Was this translation helpful? Give feedback.
What is the type of your
IDataPortal<T>
? It kind of sounds like you are using anIDataPortal<Child>
instead ofIDataPortal<ChildList>
?Update: actually it looks like you create the list as a child by calling
FetchChild
.At some point you must use the root data portal to get the top-level root object, and that is the option that you need to save. You can't directly save an object that you created via
FetchChild
.