Issues with DataPortal.UpdateChild method in case of BusinessListBase child class #2449
Replies: 8 comments 2 replies
-
From CSLA 4.x to 5.x the way the data portal finds and invokes methods was changed at lot to implement the ability to In 5.5.0 and 5.5.1 there was a change, but only to the DeleteChildSelf operation: #2396 So I'm not sure why this is failing for you. We need to create a unit test to reproduce the failure. Ideally a new test or tests here |
Beta Was this translation helpful? Give feedback.
-
Thank you Rockford for your quick reply. Just to clarify one thing here, we are having Asp.Net Web Form Application; not the Asp.Net Core application. And hence, we have used NuGet packages from "https://www.nuget.org/packages/CSLA-ASP.NET/5.0.0-R19040402" Do let me know if you need any more details or information from me on this to replicate the issue. |
Beta Was this translation helpful? Give feedback.
-
So you are using the prerelease of 5.0.0, not the prerelease of 5.5.1 or the final release of 5.5.0? In any case, the data portal method invocation tests are in that file I referenced - the implementation is the same for all platforms. |
Beta Was this translation helpful? Give feedback.
-
Hello Rockford, There was a typo in the URL of NuGet I posted in my last comment. We are actually using Pre release of 5.5.1 version (but the issue I am talking about, is same in 5.5.0 and 5.4.0 as well). We got NuGet from below URL "https://www.nuget.org/packages/Csla.AspNet/5.5.1-R21080301". Apart from this, we have created a small Asp.Net application to replicate the exact issue. I have attached zip file of the entire solution. In that, the Hotel.Server.cs class breaks on UpdateChild method for child list. We have kept the logic on Page_Load of default.aspx page only, so the logic will execute on the application startup only. I have removed 'packages' folder due to size constraint, but as I said, we have used 5.5.1 Pre release version of CSLA. I am attaching the solution zip file here for the team to replicate the issue and provide us further suggestions. |
Beta Was this translation helpful? Give feedback.
-
Hi Team, Any updates on progress on this one? |
Beta Was this translation helpful? Give feedback.
-
My "day job" has been very demanding of late, hopefully I'll get some quality CSLA time yet this week. |
Beta Was this translation helpful? Give feedback.
-
When you call In the protected override void Child_Update(params Object[] parameters)
{
base.Child_Update(parameters);
} Notice that this method (by default) then calls the base class method to update all child in the collection, passing that same list of parameters. As a result, the expectation is that each item in the collection will have a child insert/update/delete method that accepts that same list of parameters. The assumption being that if you passed a reference to [InsertChild]
private void Child_Insert(Hotel h)
{
int a = 1;
}
[UpdateChild]
private void Child_Update(Hotel h)
{
int a = 1;
}
[DeleteSelfChild]
private void Child_DeleteSelf(Hotel h)
{
int a = 1;
} |
Beta Was this translation helpful? Give feedback.
-
I experience a similar problem while upgrading from CSLA 4.11.2 to 5.5.1. In 4.11.2, the below function (in an editable child) without any parameter would work perfectly
In 5.5.1, however, I got the exact same error
If I add the following function to the child, it will work fine.
It makes sense to pass the parent object to Child_Update, I can see it can be useful sometime. Is it possible to make this parameter optional to make it backward compatible? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Team,
We have been using CSLA in our Asp.Net Web application since 12-13 years. We are using CSLA 4.3.13.0 in our application since long. Now, recently we decided to upgrade the CSLA Version on our application. We initially used CSLA 5.4.0 and then eventually upgraded to CSLA 5.5.0 and 5.5.1 (which is just released last week). This upgrade activity is still in development phase and we are seeing what all changes we would need in our application to work with latest DLLs and we are also updating things at several places.
On this activity, we are now left with one type of issue with DataPortal.UpdateChild method. Please find below details about the issue:
CSLA version: 5.5.1.0
OS: Windows
Platform: ASP.Net application
We have following classes:
From UI, we have pages to add/update hotels and also pages for insert/update/delete hotelrooms as child of Hotel. So, let's consider a scenario where we have a Hotel adding in the system with zero hotel rooms. Now, we move to the page to add HotelRooms under that Hotel. So, we have some code as below:
So, above h.Save() line goes to 'DataPortal_Update' of Hotel.cs class; where we have also called below line to update the child list of HotelRoom:
Now, the above line is supposed to go to a proper method of HotelRoom.Server.cs class (either Child_Insert, Child_Update or Child_DeleteSelf) based on different flags of the object (IsNew, IsDirty, IsDeleted etc). In our application, in case of Inserting HotelRoom, Updating or Deleting HotelRoom, we are maintaining the same pattern of getting Hotel object and then updating the HotelRoomList property of hotel object and then hitting "DataPortal.UpdateChild(HotelRoomList, this);" line in all cases.
Until we were using CSLA 4.3.13.0, we were successfully able to use above pattern and the flow was correctly going into Child_Insert, Child_Update or Child_DeleteSelf method of HotelRoom.server.cs class.
But since we are using CSLA 5.4.0 or 5.5.0 and 5.5.1, the above implementation is not working for us. In the above case of inserting HotelRoom, system throws below exception when we call "DataPortal.UpdateChild(HotelRoomList, this);" line to insert/update the HotelRoom child:
Now, as the above implementation is not working anymore, we did some analysis and went through release notes of version between 4.3.13.0 to 5.5.1.0; but we couldn't find any exact point where above implementation is changed (though we could find out some changes related to UpdateChild method). The above implementation works just fine with CSLA 4.3.13.0.
While finding solution to this, we could observe that the things was working fine if we replace line from "DataPortal.UpdateChild(HotelRoomList, this);" to "DataPortal.UpdateChild(HotelRoomList);". But it then breaks update case of HotelRoom object, and hence we have to keep both version of above line, separate for Insert and Update operations. This is not feasible for us to do as we have above type of implementation at hundreds of places in our application.
Can someone guide us on this and let us know what we can do for this and why this line has stopped working with CSLA 5.5.1.0. Also, if there are any plan to address this in next release of CSLA.
Beta Was this translation helpful? Give feedback.
All reactions