DataPortal.Fetch failed Invalid operation - fetch not allowed

DataPortal.Fetch failed Invalid operation - fetch not allowed

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


Frazer posted on Thursday, September 03, 2009

I am sure I am missing something simple.  I am implementing a ReadOnlyBase-derived business object:

Public Function GetBranchGLCache(ByVal cacheID As Guid) As BranchGLCache
  Return CType(DataPortal.Fetch(New SingleCriteria(Of BranchGLCache, Guid) _
                           (cacheID)), BranchGLCache)
End Function

 

Private Overloads Sub DataPortal_Fetch(ByVal branchGLCache As 
                                    
_ DAL.BranchGLTransactionSummaryCache)
  If Not (branchGLCache Is Nothing) Then
    With branchGLCache
      LoadProperty(Of Guid)(BranchCacheIdProperty, BranchCacheId)
      ..etc
    End With
   End If
End Sub

I get an "invalid operation - fetch not allowed" which would make me think that the declararation of the DataPortal_Fetch method is incorrect.  I have tried Protected, Shadows etc.. all to no avail.  Can someone point out my problem?

 

RockfordLhotka replied on Thursday, September 03, 2009

Your DataPortal_Fetch() must accept a criteria parameter of the same type as the criteria you passed into DataPortal.Fetch(). In your example it is a SingleCriteria object, and your parameter types don't match.

Frazer replied on Thursday, September 03, 2009

Of course.  Forest for the trees.

Thanks Rocky.

 

 

Copyright (c) Marimer LLC