
Procedimientos Almacenados en ASP .Net MVC
Publicado por Niebla (7 intervenciones) el 12/02/2014 12:13:00
Tengo un nuevo procedimiento almacenado que llamo desde la función:
public virtual ObjectResult<Attribute> GetAttributesByCategoryId(Nullable<int> categoryId)
{
var categoryIdParameter = categoryId.HasValue ?
new ObjectParameter("CategoryId", categoryId) :
new ObjectParameter("CategoryId", typeof(int));
//Llamada al procedimiento almacenado que busca los atributos de una categoría
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Attribute>("GetAttributesByCategoryId", categoryIdParameter);
}
El Procedimiento es GetArritbutesByCategoryId y está creado en la BD
Y sin embargo me encuentro el siguiente error al ejecutar la función:
Server Error in '/' Application.
The FunctionImport 'GetAttributesByCategoryId' could not be found in the container 'MainModelContainer'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The FunctionImport 'GetAttributesByCategoryId' could not be found in the container 'MainModelContainer'.
Source Error:
Line 1028:
Line 1029: //Llamada al procedimiento almacenado que busca los atributos de una categoría
Line 1030: return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Attribute>("GetAttributesByCategoryId", categoryIdParameter);
Line 1031: }
Line 1032: //FIN EVO-0020-2013-DC Nachordone 11/02/2013
Source File: o:\proyectos\Kvantex_V1\FrontOffice\Portal.FrontOffice.Repository.EntityFramework\Models\MainModel\MainModelContainer.cs Line: 1030
Stack Trace:
[InvalidOperationException: The FunctionImport 'GetAttributesByCategoryId' could not be found in the container 'MainModelContainer'.]
System.Data.Common.Utils.CommandHelper.FindFunctionImport(MetadataWorkspace workspace, String containerName, String functionImportName) +2725061
System.Data.Objects.ObjectContext.CreateEntityCommandForFunctionImport(String functionName, EdmFunction& functionImport, ObjectParameter[] parameters) +91
System.Data.Objects.ObjectContext.ExecuteFunction(String functionName, MergeOption mergeOption, ObjectParameter[] parameters) +105
System.Data.Objects.ObjectContext.ExecuteFunction(String functionName, ObjectParameter[] parameters) +57
public virtual ObjectResult<Attribute> GetAttributesByCategoryId(Nullable<int> categoryId)
{
var categoryIdParameter = categoryId.HasValue ?
new ObjectParameter("CategoryId", categoryId) :
new ObjectParameter("CategoryId", typeof(int));
//Llamada al procedimiento almacenado que busca los atributos de una categoría
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Attribute>("GetAttributesByCategoryId", categoryIdParameter);
}
El Procedimiento es GetArritbutesByCategoryId y está creado en la BD
Y sin embargo me encuentro el siguiente error al ejecutar la función:
Server Error in '/' Application.
The FunctionImport 'GetAttributesByCategoryId' could not be found in the container 'MainModelContainer'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The FunctionImport 'GetAttributesByCategoryId' could not be found in the container 'MainModelContainer'.
Source Error:
Line 1028:
Line 1029: //Llamada al procedimiento almacenado que busca los atributos de una categoría
Line 1030: return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Attribute>("GetAttributesByCategoryId", categoryIdParameter);
Line 1031: }
Line 1032: //FIN EVO-0020-2013-DC Nachordone 11/02/2013
Source File: o:\proyectos\Kvantex_V1\FrontOffice\Portal.FrontOffice.Repository.EntityFramework\Models\MainModel\MainModelContainer.cs Line: 1030
Stack Trace:
[InvalidOperationException: The FunctionImport 'GetAttributesByCategoryId' could not be found in the container 'MainModelContainer'.]
System.Data.Common.Utils.CommandHelper.FindFunctionImport(MetadataWorkspace workspace, String containerName, String functionImportName) +2725061
System.Data.Objects.ObjectContext.CreateEntityCommandForFunctionImport(String functionName, EdmFunction& functionImport, ObjectParameter[] parameters) +91
System.Data.Objects.ObjectContext.ExecuteFunction(String functionName, MergeOption mergeOption, ObjectParameter[] parameters) +105
System.Data.Objects.ObjectContext.ExecuteFunction(String functionName, ObjectParameter[] parameters) +57
Valora esta pregunta


0