0

我开始使用它,但 Any and All 没有在 Linq To SQl 上使用 ReflectionProvider。并且失败并出现以下错误。有关如何解决此问题的任何指示。

Unhandled Exception: System.Data.Services.Client.DataServiceQueryException: An error occurred while processing this request. —> System.Data.Services
 .Client.DataServiceClientException: **An error occurred while processing this request.Argument type
 s do not matchSystem.ArgumentException at System.Linq.Expressions.Expression.Condition(Expression test**, Expressio
 n ifTrue, Expression ifFalse) 
4

1 回答 1

0

我在使用 WCF Data Services V5 和 NHibernate(使用 Re-linq 作为 QueryProvider)时遇到了同样的问题。我发现根据我是直接针对 NHibernate 会话还是针对数据服务客户端运行以下 LINQ 查询,会生成不同的表达式:

.Where(x => x.Staff.Any(y => y.FirstName == "Bill"))

如果我针对会话查询它,它会生成以下表达式:

{value(NHibernate.Linq.NhQueryable`1[WcfDataServicesTest.Entities.Store]).Where(x => x.Staff.Any(y =    > (y.FirstName == "Bill")))}

但是当我查询客户端时,我得到以下信息:

{value(NHibernate.Linq.NhQueryable`1[WcfDataServicesTest.Entities.Store]).Where(it => IIF((it.Staff == null), Empty(), it.Staff).Any(p => (p.FirstName == "Bill")))}

注意额外的条件表达式(IIF...)?

我还不知道原因,但我找到了一个半体面的解决方法,直到我这样做:

http://abilityforge.com/?p=18

编辑:这是对似乎是什么问题的详细解释(以及更好的解决方案):http ://blog.davidebbo.com/2011/08/how-odata-quirk-killed-nuget-server.html

于 2012-11-23T07:47:22.057 回答