Dataportal.Create failed

Dataportal.Create failed

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


f.scherer posted on Monday, June 19, 2006

Hi,

i just started using csla.net after reading the book the first time (i think i am going to read it once more...)
But anyway, i followed the book setting up a web page to insert customer data into a database.
My process is related to setting up the projects in the ProjectEdit.aspx.

When the page is loaded i see my list of customers, which is fine (and means that the access to database works...) As soon a i press my new customer button, i get an exception "Dataportal.Create failed."
If i look closer into the exception there is another line : Invalid operation - create not allowed.
Also it says that the error is in BusinessBase line 906 when DataPortal_Create is called.

Here is the complete error message:
Line 904:    <System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", MessageId:="Member")> _
Line 905: Protected Overridable Sub DataPortal_Create(ByVal criteria As Object)
Line 906: Throw New NotSupportedException( _
Line 907: My.Resources.CreateNotSupportedException)
Line 908: End Sub

Source File: C:\csla\csla20vb\csla20vb\Csla\Core\BusinessBase.vb    Line: 906

Stack Trace:

[NotSupportedException: Invalid operation - create not allowed]
Csla.Core.BusinessBase.DataPortal_Create(Object criteria) in C:\csla\csla20vb\csla20vb\Csla\Core\BusinessBase.vb:906

[CallMethodException: DataPortal_Create method call failed]
Csla.MethodCaller.CallMethod(Object obj, MethodInfo info, Object[] parameters) in C:\csla\csla20vb\csla20vb\Csla\DataPortal\MethodCaller.vb:70
Csla.MethodCaller.CallMethod(Object obj, String method, Object[] parameters) in C:\csla\csla20vb\csla20vb\Csla\DataPortal\MethodCaller.vb:51
Csla.Server.SimpleDataPortal.Create(Type objectType, Object criteria, DataPortalContext context) in C:\csla\csla20vb\csla20vb\Csla\DataPortal\Server\SimpleDataPortal.vb:45

[DataPortalException: DataPortal.Create failed]
Csla.DataPortal.Create(Type objectType, Object criteria) in C:\csla\csla20vb\csla20vb\Csla\DataPortal\Client\DataPortal.vb:106
Csla.DataPortal.Create() in C:\csla\csla20vb\csla20vb\Csla\DataPortal\Client\DataPortal.vb:64
MT.Lib.Kunde.NewKunde() in C:\Documents and Settings\fsc\My Documents\Visual Studio 2005\Projects\MT\MT.Lib\Kunde.vb:269
KundenEdit.GetKunde() in C:\Inetpub\wwwroot\MT\KundenEdit.aspx.vb:20
KundenEdit.KundenDataSource_SelectObject(Object sender, SelectObjectArgs e) in C:\Inetpub\wwwroot\MT\KundenEdit.aspx.vb:33
Csla.Web.CslaDataSource.OnSelectObject(SelectObjectArgs e) in C:\csla\csla20vb\csla20vb\Csla\Web\CslaDataSource.vb:130
Csla.Web.CslaDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) in C:\csla\csla20vb\csla20vb\Csla\Web\CslaDataSourceView.vb:65
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.DetailsView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.DetailsView.EnsureDataBound() +181
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +41
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360


Can somebody help me with that error.

Thanks in advance,

Frank.

ajj3085 replied on Monday, June 19, 2006

You need to override the DataPortal_Create method.

Copyright (c) Marimer LLC