I want to execute this Procedure using entity framework
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROC [dbo].[ProjectTableRowCount]
(
@ProjectId int,
@SearchKey varchar(50) ,
@PageNo int ,
@PazeSize int
)
AS
BEGIN
SELECT AllTableInfo.Id , AllTableInfo.tableName ,AllTableInfo.[rowCount] , AllTableInfo.isActive FROM
( SELECT [Table].Id, TABLE_INFO.*, [Table].isActive, ROW_NUMBER() OVER(ORDER BY [Table].isActive) AS rownumber FROM [Table]
INNER JOIN
(
SELECT A.Name 'tableName', SUM(B.rows) AS 'rowCount'
FROM sys.objects A
INNER JOIN sys.partitions B ON A.object_id = B.object_id
WHERE A.type = 'U'
GROUP BY A.schema_id, A.Name
) AS TABLE_INFO
ON [Table].tableName = TABLE_INFO.tableName ) AS AllTableInfo
INNER JOIN ProjectTable ON
ProjectTable.tablesId = AllTableInfo.Id
WHERE ProjectTable.ProjectId = @ProjectId
AND AllTableInfo.tableName LIKE '%'+@SearchKey +'%'
AND rownumber > (( @PageNo -1) * @PazeSize )
AND rownumber <= ((@PageNo - 1)* @PazeSize)+ @PazeSize
END
my Entity code
public virtual ObjectResult<ProjectTableRowCount_Result> ProjectTableRowCount(Nullable<int> projectId, string searchKey, Nullable<int> pAGENO, Nullable<int> pazeSize)
{
var projectIdParameter = projectId.HasValue ?
new ObjectParameter("projectId", projectId) :
new ObjectParameter("projectId", typeof(int));
var searchKeyParameter = searchKey != null ?
new ObjectParameter("SearchKey", searchKey) :
new ObjectParameter("SearchKey", typeof(string));
var pAGENOParameter = pAGENO.HasValue ?
new ObjectParameter("PAGENO", pAGENO) :
new ObjectParameter("PAGENO", typeof(int));
var pazeSizeParameter = pazeSize.HasValue ?
new ObjectParameter("PazeSize", pazeSize) :
new ObjectParameter("PazeSize", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<ProjectTableRowCount_Result>("ProjectTableRowCount", projectIdParameter, searchKeyParameter, pAGENOParameter, pazeSizeParameter);
}
But the error is
"The function import could not be found in the container"
I add the function import by the information given on
http://msdn.microsoft.com/en-us/library/bb896231.aspx
Please help ...