Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Linq存储过程问题_C#_Linq - Fatal编程技术网

C# Linq存储过程问题

C# Linq存储过程问题,c#,linq,C#,Linq,大家好 我对Linq和我的存储过程有问题。我得到的错误是: 找不到源类型“int”的查询模式的实现选择“未找到” 以下是在my DbClass中找到的代码: [Function(Name="dbo.findahostel_getHostelsByTags")] public IEnumerable<hostel> findahostel_getHostelsByTags([Parameter(DbType="VarChar(150)")] string tags) { IEx

大家好

我对Linq和我的存储过程有问题。我得到的错误是:

找不到源类型“int”的查询模式的实现选择“未找到”

以下是在my DbClass中找到的代码:

[Function(Name="dbo.findahostel_getHostelsByTags")]
public IEnumerable<hostel> findahostel_getHostelsByTags([Parameter(DbType="VarChar(150)")] string tags)
{
    IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), tags);
    return ((IEnumerable<hostel>)(result.ReturnValue));
}
[函数(Name=“dbo.findahostel_getHostelsByTags”)]
公共IEnumerable findahostel_GetHostelByTags([Parameter(DbType=“VarChar(150)”)]字符串标记)
{
IExecuteResult=this.ExecuteMethodCall(this,((MethodInfo)(MethodInfo.GetCurrentMethod()),标记);
返回((IEnumerable)(result.ReturnValue));
}
这是我的Linq代码:

IQueryable<hostel> hostels = from h in db.findahostel_getHostelsByTags_Name(searchQuery)
                                         select h;
IQueryable hostels=从h开始,在db.findahostel\u getHostelsByTags\u Name中(searchQuery)
选择h;
我在任何地方都找不到对int的引用


Matt

我认为问题在于您试图将result.ReturnValue强制转换为
IEnumerable
,我非常确定ReturnValue是int。这是存储过程返回的内容,不能与存储过程也“返回”的行混淆。

编译器真的在抱怨代码的底线吗?我觉得不太可能。如果您将鼠标悬停在方法调用上,它是否会显示返回类型?嘿,Jon,我按照您所说的进行了检查,一切正常;我的主机引用旧文件时,似乎是缓存问题。现在一切都好了。谢谢是的,那将是正确的伴侣;最后在我的寄宿端成了缓存问题。