2

我正在使用 WCF 数据服务和 RavenDB。

一切似乎都很好,直到我想出了一件事:通过 ID 查询。

无论是这种方式:

/DataService.svc/EntitySet?$filter=ID eq '123'

或者:

/DataService.svc/EntitySet('123')

当我尝试拨打这些网址中的任何一个时,我得到以下信息:

Attempt to query by id only is blocked, you should use call session.Load("123");
instead of session.Query().Where(x=>x.Id == "123");
You can turn this error off by specifying
documentStore.Conventions.AllowQueriesOnId = true;
but that is not recommend and provided for backward compatibility reasons only.

如何中断 WCF 数据服务以使用 session.Query() 对数据库进行自定义调用而不是默认调用?

据我所知,查询拦截器不起作用,因为它们需要定义一个特定的 EntitySet。

4

0 回答 0