DataPortal.Create Error

DataPortal.Create Error

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


SouthSpawn posted on Friday, February 15, 2008

When ever I try to do the "

Return DataPortal.Create(Of Company)(New Criteria(0, TypeID))"

I am getting the following "Server.DataPortalException" error message.

?ex.Message

"DataPortal.Create failed on the server"

?ex.InnerException

{"Object reference not set to an instance of an object."}

System.NullReferenceException: {"Object reference not set to an instance of an object."}

Data: {System.Collections.ListDictionaryInternal}

HelpLink: Nothing

InnerException: Nothing

Message: "Object reference not set to an instance of an object."

Source: "Csla"

StackTrace: " at Csla.Server.CallMethodException..ctor(String message, Exception ex) in D:\Components\CSLA\cslavb\Csla\DataPortal\Server\CallMethodException.vb:line 45

at Csla.MethodCaller.CallMethod(Object obj, MethodInfo info, Object[] parameters) in D:\Components\CSLA\cslavb\Csla\DataPortal\MethodCaller.vb:line 123

at Csla.Server.SimpleDataPortal.Create(Type objectType, Object criteria, DataPortalContext context) in D:\Components\CSLA\cslavb\Csla\DataPortal\Server\SimpleDataPortal.vb:line 52"

TargetSite: {System.Reflection.RuntimeConstructorInfo}

JohnB replied on Friday, February 15, 2008

SouthSpawn:
Return DataPortal.Create(Of Company)(New Criteria(0, TypeID))

The Return statement above is correct. You just need to change the declaration of your DataPortal_Create.

From:
Protected Overrides Sub DataPortal_Create()
End Sub

To:
Protected Overloads Sub DataPortal_Create(ByVal criteria As Object)
End Sub

Also remove the <Csla.RunLocal()> attribute if you're hitting the database.

Copyright (c) Marimer LLC