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.