Good afternoon,
I am admittedly a CSLA beginner, but I am learning it for work now. I was attempting to create a ReadOnlyBase object as per page 399 of the VB 2005 version of the book. On that page, the factory function definition is as follows for retrieving a read only root object:
Public Shared Function GetReadOnlyRoot(ByVal id as Integer) as ReadOnlyRoot
Return DataPortal.Create(Of ReadOnlyRoot)(New Criteria(id))
End Function
The following DataPortal_ function is defined on page 400:
Private Overloads Sub DataPortal_Fetch(ByVal criteria as Criteria)
' load values
End Sub
From my understanding and from the fact that my code, when modelled after this, would throw an exception, I am wondering if it should be:
Public Shared Function GetReadOnlyRoot(ByVal id as Integer) as ReadOnlyRoot
Return DataPortal.Fetch(Of ReadOnlyRoot)(New Criteria(id))
End Function
The following exception is thrown when DataPortal.Create is used:
Unhandled Exception: Csla.DataPortalException: DataPortal.Create failed ---> Csla.Server.CallMethodException: DataPortal_Create method call failed ---> System.NotSupportedException: Invalid operation - create not allowed
It works as expected when DataPortal.Fetch is used.
Thanks in advance,
Christian
Thanks Rocky.
BTW, Mike and Yogi from CES say Hi.
Copyright (c) Marimer LLC