The value of EntityCommand.CommandText is not valid

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
sclegg
Posts: 6
Joined: Fri 11 Sep 2009 15:51
Location: Idaho

The value of EntityCommand.CommandText is not valid

Post by sclegg » Mon 14 Sep 2009 16:27

Stored procedure calls from ASP.Net to the Entity Framework model is generated incorrectly from Entity Developer.

In version, 2,20.37, of Entity Developer, I created from database two objects- a simple table and a simple package (Oracle) ..._LOG_PKG.ADD_ERROR_LOG. Within this model, I created a method from the package called AddErrorLog. Next, I select generate from the pull down menu (Project->Generate). Next, I add the *model.cs file to my new ASP.NET MVC project under the Models folder. Next, I add the 3 associated files ( *model.csdl, *model.msl, *model.ssdl).

Within my code, I call the model's entitites -

XYZmodel.XYZEntities db = new XYZmodel.XYZEntities();
db.AddErrorLog(x,y,z);

Unfortunately, at run time, the system threw an error:
System.InvalidOperationException was unhandled by user code
Message="The value of EntityCommand.CommandText is not valid for a StoredProcedure command. The EntityCommand.CommandText value must be of the form 'ContainerName.FunctionImportName'."
Source="System.Data.Entity"
StackTrace:
at System.Data.Common.Utils.CommandHelper.ParseFunctionImportCommandText(String commandText, String defaultContainerName, String& containerName, String& functionImportName)
at System.Data.EntityClient.EntityCommand.DetermineFunctionImport()
at System.Data.EntityClient.EntityCommand.MakeCommandTree()
at System.Data.EntityClient.EntityCommand.CreateCommandDefinition()
at System.Data.EntityClient.EntityCommand.TryGetEntityCommandDefinitionFromQueryCache(EntityCommandDefinition& entityCommandDefinition)
at System.Data.EntityClient.EntityCommand.GetCommandDefinition()
at System.Data.EntityClient.EntityCommand.InnerPrepare()
at System.Data.EntityClient.EntityCommand.Prepare()
at System.Data.EntityClient.EntityCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.EntityClient.EntityCommand.ExecuteScalar[T_Result](Func`2 resultSelector)
at System.Data.EntityClient.EntityCommand.ExecuteNonQuery()at XYZmodel.XYZEntities.AddErrorLog(.....


This issue is due to incorrect text in the *model.cs where the command.CommandText = @"ADD_ERROR_LOG" should be command.CommandText = @"XYZEntities.AddErrorLog" as mapped in the *model.csdl

See http://social.msdn.microsoft.com/Forums ... 8952508ba7 for details (located at the end of the blog).

For now, I must manually edit the *model.cs file to map to the correct entity. Is there a fix available for this issue or is there a switch or setting that I overlook? Please advise.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 17 Sep 2009 13:59

Thank you for the report, I have reproduced the problem.
I will let you know about the results of our investigation.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 23 Oct 2009 11:58

The problem is fixed.
The fix will be available in the upcoming Beta build of Entity Developer.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 02 Nov 2009 08:41

This problem was fixed in the latest Beta build of Entity Developer.

Post Reply