Im getting the following error when I try to create a new EditableRoot object
DataPortal.Create failed (System.NotSupportedException: Invalid operation - create not allowed
at Csla.Core.BusinessBase.DataPortal_Create())
The code I have is straight from the template and all other sections seem to work.
When stepping through the code I put a break point on the line
Protected Overloads Sub DataPortal_Create(ByVal objCriteria As Object)
but execution never gets to here.
Im getting around at the minute by changing my New factory method to
Public Shared Function NewItem() As clsItem
If Not CanAddObject() Then
Throw New System.Security.SecurityException("User not authorized to add a Item")
End If
Return New clsItem'todo: broken - awaiting support
'Return DataPortal.Create(Of clsItem)()
End Function
Any ideas?
Protected Overrides Sub DataPortal_Create()
Not Overloads. You also dont' want to specify any criteria, becausey ou are calling DP.C(Of T) without parameters.
Are you sure?
The project tracker project has it exactly as I have imported from codesmith templates. And all of my DataPortal_XYZ functions are similarly declared
I get a compile error when I replace Overloads with Overrides
Error 4 sub 'DataPortal_Create' cannot be declared 'Overrides' because it does not override a sub in a base class. D:\_Development\Contest\v03\Dev\Contest\Contest.Library\CSLA Root Child Test\clsItem.vb 531 29 Contest.Library
Im not sure what version Im on - how do I tell?
Whoops. Works OK now. So should the other DataPortal_ methods be declared overrides instead of Overloads?
In fact, it works fine with Overloads as long as the parameter is removed
OK.
Thanks for your help
ajj3085:Hmm... that must be a VB thing. In C#, you'd get a compile warning because have a new member (the Overloadd one) conflicting with the inhertied member.
Fetch has been changed too; see the changelog for details.
No, the warning should appear in VB too - something about the method being in conflict and behind automatically shadowed by the subclass. But it is just a warning, not an error, so if you don't have the switch set to treat warnings like errors you might not notice it right away.
Copyright (c) Marimer LLC