【问题标题】:Entity framework not showing the correct return type of the procedure sql实体框架未显示过程 sql 的正确返回类型
【发布时间】:2013-08-16 21:59:59
【问题描述】:
    ALTER PROCEDURE [dbo].[SearchData] 
    -- Add the parameters for the stored procedure here
    @searchparameter varchar(100)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

SELECT cat.CategoryId,cat.CategoryImageURL,cat.CategoryName,cat.isDeleted,ap.AppCreatedBy,ap.AppCreatedOn
,ap.AppDetails,ap.AppId,ap.AppImageURL,ap.AppModifiedBy,ap.AppModifiedOn,ap.AppName,ap.isDeleted,subcat.SubCategoryId
,subcat.SubCategoryName,subcat.SubCategoryImageUrl
  FROM Category cat JOIN App ap
       ON cat.CategoryID = ap.CategoryID 
       Join SubCategory subcat ON subcat.SubCategoryId = ap.SubCategoryId   
  WHERE FREETEXT (cat.CategoryName, @searchparameter) OR  FREETEXT (subcat.SubCategoryName,@searchparameter) OR FREETEXT (ap.AppName,@searchparameter)
  OR CONTAINS (ap.AppDetails,@searchparameter) OR CONTAINS (cat.CategoryName, @searchparameter) OR  CONTAINS (subcat.SubCategoryName,@searchparameter) OR CONTAINS (ap.AppName,@searchparameter)
  OR CONTAINS (ap.AppDetails,@searchparameter) OR ap.AppName LIKE @searchparameter + '%' ORDER BY ap.AppName

END

但是当我从数据库更新模型时,虽然我想返回所有上述值,但存储过程在实体框架中显示返回类型为 int。

请帮忙

【问题讨论】:

  • 您是否尝试过在您的 edm 中完全删除对过程的引用,然后重新添加它?
  • 是的,我试过了..

标签: sql sql-server c#-4.0 entity-framework-4


【解决方案1】:

存储过程的返回类型总是int

您需要将其映射到在实体模型中返回复杂类型的函数。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多