CSLA 3.8 - Fetch Not Allowed ???

CSLA 3.8 - Fetch Not Allowed ???

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


Q Johnson posted on Wednesday, February 23, 2011

I'm trying to load a Dynamic List and when the Shared Factory method tries the call to Fetch, an exception is raised saying Fetch Not Allowed.  I'm using a nested criteria class and the constructor fired just fine and all the properties are set appropriately.  The very brief code in the DynList executed, too (AllowNew = True).

In the stack trace I see:  Csla.EditableRootListBase`1.DataPortal_Fetch(Object criteria)

Here's all the details offered, below.  I can't help but wonder if there's a typo in CSLA code that generated the odd character between the e in Base and the 1, just before .DataPortal.  Any thoughts?

 

Csla.DataPortalException was unhandled
  Message="DataPortal.Fetch failed (Invalid operation - fetch not allowed)"
  Source="Csla"
  StackTrace:
       at Csla.EditableRootListBase`1.DataPortal_Fetch(Object criteria)
       at dm(Object , Object[] )
       at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters)
       at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters)
       at Csla.Reflection.MethodCaller.CallMethod(Object obj, String method, Object[] parameters)
       at Csla.Reflection.LateBoundObject.CallMethod(String method, Object[] parameters)
       at Csla.Server.SimpleDataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context)
       at Csla.DataPortal.Fetch(Type objectType, Object criteria)
       at Csla.DataPortal.Fetch[T](Object criteria)
       at KyStartRptLibrary.RptDetailRecordList.GetRecordDetail(String pstrServerName, String pstrDBName, DateTime pdtmBegin, DateTime pdtmEnd, Double pdblIRSLimit) in C:\VS2008_Solutions\KyStartRpt\KyStartRptLibrary\Collections\RptDetailRecordList.vb:line 334
       at KyStartRptUI.BuildReportFile.btnReportData_Click(Object sender, EventArgs e) in C:\VS2008_Solutions\KyStartRpt\KyStartRptUI\BuildReportFile.vb:line 110
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e)
       at DevExpress.XtraEditors.BaseButton.OnKeyUp(KeyEventArgs e)
       at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
       at System.Windows.Forms.Control.WmKeyChar(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at KyStartRptUI.TeamNFPCoreMod.Main() in C:\VS2008_Solutions\KyStartRpt\KyStartRptUI\TeamNFPCoreMod.vb:line 28
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: Csla.Reflection.CallMethodException
       Message="DataPortal_Fetch method call failed"
       Source="Csla"
       StackTrace:
            at Csla.EditableRootListBase`1.DataPortal_Fetch(Object criteria)
            at dm(Object , Object[] )
            at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters)
            at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters)
            at Csla.Reflection.MethodCaller.CallMethod(Object obj, String method, Object[] parameters)
            at Csla.Reflection.LateBoundObject.CallMethod(String method, Object[] parameters)
            at Csla.Server.SimpleDataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context)
       InnerException: System.NotSupportedException
            Message="Invalid operation - fetch not allowed"
            Source="Csla"
            StackTrace:
                 at Csla.EditableRootListBase`1.DataPortal_Fetch(Object criteria)
                 at dm(Object , Object[] )
                 at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters)
            InnerException:

 

RockfordLhotka replied on Wednesday, February 23, 2011

It sounds like the data portal can't find a matching overload for your criteria type, so it is falling back to the base implementation that accepts an object parameter, and that base implementation throws this exception.

Make sure you have a DataPortal_Fetch overload that accepts the correct criteria parameter type.

Q Johnson replied on Friday, February 25, 2011

That was it, exactly.  (of course <g>)

Thanks!

ntimothys replied on Thursday, September 20, 2012

Had the same problem on my very first project - turned out I to be a typo of the Dataportal_Fetch method

Copyright (c) Marimer LLC