DataPortal_Create method call failedDataPortal_Create method call failed
Old forum URL: forums.lhotka.net/forums/t/3783.aspx
dantes1 posted on Thursday, October 25, 2007
i had this exception when my webservice was tring to execute the code below...
Dim t As namespace.editableroot
t = namespace.editableroot.Neweditableroot()
the editableroot class was created using the csla2.0.x version... and now im changing it to csla3.0.2...
this is the whole message - DataPortal.Create failed (System.NotSupportedException: Invalid operation - create not allowed
at Csla.Core.BusinessBase.DataPortal_Create() in C:\development\Csla\ver_3_0_2\cslavb\Csla\Core\BusinessBase.vb:line 1184)
dont know why this is happening...
DavidDilworth replied on Friday, October 26, 2007
This exception is thrown by the CSLA core BusinessBase class if you don't override the DataPortal_Create() method.
If you are using the Data Portal to create a new instance by calling DataPortal.Create() then you MUST override this method in your class.
IanK replied on Friday, October 26, 2007
Assuming you are overriding the Dataportal_create method in your object verify your calling statement and the method both include or exclude a criteria argument.
eg
Public
Shared Function NewMyObject() As MyObject
If Not CanAddObject() Then
Throw New System.Security.SecurityException( _
"User not authorized to add a Object")
End If
Return DataPortal.Create(Of MyObject)()
end function
Private
Overloads Sub DataPortal_Create()
...
Select defaults from wherever
end sub
Copyright (c) Marimer LLC