1

For a long time now, this code has been working well for me:

session.Query<Application>()
    .Include(x => x.CustomVariableGroupIds)
    .Where(app => app.Id == id).FirstOrDefault())

However, I just upgraded my RavenDB assemblies, and I'm now getting this error:

Attempt to query by id only is blocked, you should use call session.Load("applications/4"); instead of session.Query().Where(x=>x.Id == "applications/4");

You can turn this error off by specifying documentStore.Conventions.AllowQueriesOnId = true;, but that is not recommend and provided for backward compatibility reasons only.

Okay, fine, I changed it to this:

session.Load<Application>(id)
    .Include(x => x.CustomVariableGroupIds)

But now my Include() method doesn't work:

Cannot resolve symbol 'Include'.

How do I use Include() with session.Load()?

Edit:

I've found the answer (see my answer below). Now I'm trying to find out how this fits into the new session.Load() approach:

.Customize(x => x.WaitForNonStaleResults()
4

1 回答 1

3

在这里找到了答案。我需要在Include()上使用session,而不是在Load().

session.Include<Application>(x => x.CustomVariableGroupIds)
    .Load<Application>(id))
于 2013-04-21T22:33:34.000 回答