我正在使用WCF数据服务和RavenDB。
在我提出一件事之前,一切似乎都很顺利: 通过身份查询。
要么这样:
/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.
如何使用session.Query()中断WCF数据服务来自定义调用数据库而不是默认调用?
据我所知,Query拦截器不起作用,因为它们需要定义一个特定的EntitySet。