Child_Insert Not Being Called when Parent Saved

Child_Insert Not Being Called when Parent Saved

Old forum URL: forums.lhotka.net/forums/t/7084.aspx


Frazer posted on Thursday, June 11, 2009

I have an ER :  Request which has a property: Followups which is of type FollowupList which in turn is an editable child collection.

I have implemented a method called ExecuteRequest, the purpose of which is to execute a query against a database and generate the Followup children from the query result set and add them to the Followups collection property.

The method is as follows (trimmed for clarity)

Public Function ExecuteRequest(request as Request) as Request
  dim dtFollowupResults as DataTable = ...query the db and return a dataset ...
  for each row in the datatable....
     dim newFollowup as Followup.NewFollowup()
     ... populate its properties from the row...
     request.Followups.Add(newFollowup)
  next row
  request = request.Save()
  return request
End Function

My problem is that a DataPortalExecption is thrown when I call the Request.Save() method.  Stack trace as follows:

   at dm(Object , Object[] )
   at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\MethodCaller.cs:line 298
   at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\MethodCaller.cs:line 305
   at Csla.Reflection.MethodCaller.CallMethod(Object obj, String method, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\MethodCaller.cs:line 226
   at Csla.Reflection.LateBoundObject.CallMethod(String method, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\LateBoundObject.cs:line 86
   at Csla.Server.ChildDataPortal.Update(Object obj, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Server\ChildDataPortal.cs:line 201
   at Csla.Server.ChildDataPortal.Update(Object obj, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Server\ChildDataPortal.cs:line 262
   at Csla.DataPortal.UpdateChild(Object child, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\DataPortal.cs:line 939
   at Csla.BusinessListBase`2.Child_Update(Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\BusinessListBase.cs:line 957
   at dm(Object , Object[] )
   at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\MethodCaller.cs:line 298
   at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\MethodCaller.cs:line 305
   at Csla.Reflection.MethodCaller.CallMethod(Object obj, String method, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\MethodCaller.cs:line 226
   at Csla.Reflection.LateBoundObject.CallMethod(String method, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\LateBoundObject.cs:line 86
   at Csla.Server.ChildDataPortal.Update(Object obj, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Server\ChildDataPortal.cs:line 228
   at LSI.Business.Followup.Request.DataPortal_Update() in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\LSI.Followup\LSI.Business.Followup\Request.vb:line 759
   at dm(Object , Object[] )
   at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\MethodCaller.cs:line 298
   at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\MethodCaller.cs:line 305
   at Csla.Reflection.MethodCaller.CallMethod(Object obj, String method, Object[] parameters) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\MethodCaller.cs:line 226
   at Csla.Reflection.LateBoundObject.CallMethod(String method) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Reflection\LateBoundObject.cs:line 70
   at Csla.Server.SimpleDataPortal.Update(Object obj, DataPortalContext context) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\csla\Csla\Server\SimpleDataPortal.cs:line 211
   at LSI.Business.Followup.RequestList.ExecuteRequest(Guid requestID) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\LSI.Followup\LSI.Business.Followup\RequestList.vb:line 170
   at LSI.UI.Followup.frmMain.RequestMenuClick(Object sender, EventArgs e) in C:\Users\FSmith\Documents\Visual Studio 2008\Projects\LSI.Followup\LSI.UI.Followup\Forms\frmMain.vb:line 301
   at Gizmox.WebGUI.Forms.Component.FireEvent(IEvent objEvent)
   at Gizmox.WebGUI.Forms.TreeNode.FireEvent(IEvent objEvent)
   at Gizmox.WebGUI.Forms.RegisteredComponent.2AAAA(IEvent 0AAAA)
   at Gizmox.WebGUI.Server.Content.ProcessRequest(HttpContext objHttpContext)

I am sure I have made an error in the implementation of one of my business object classes, however, I have tried to follow the templates in the book closely and cannot see where my mistake is.  Can anyone suggest, based on where this exception is thrown in the framework, where I might look for my problem/

 

Frazer replied on Thursday, June 11, 2009

Problem solved.  My child portal methods were expecting an additional argument (parent EF data entity) which were not been provided by the caller.

 

 

RockfordLhotka replied on Friday, June 12, 2009

Unfortunately, while you provided the stack trace, you didn't provide the exception itself?

Copyright (c) Marimer LLC