开发者

How to do a RavenDb Query index result as Include to document

开发者 https://www.devze.com 2023-02-20 21:27 出处:网络
Both of the following queries work as expected. I\'m having trouble figuring out how to return both from the database in one pull using the \"Include()\" method.

Both of the following queries work as expected. I'm having trouble figuring out how to return both from the database in one pull using the "Include()" method.

var result = _documentsSession
    .Advanced
    .LuceneQuery<MessageStatisticResult, MessageSummaryByUserIndex>()
    .Where("Email:" + command.UserName);

var user = _documentSession
    .Load<IUser>("users/" + command.UserName);

A soon as I add the "Include()" method both the Query() and A开发者_如何学Pythondvance() are no longer relevant. Is there a way to do this?


This also produces results but does not get both in one trip to the database:

var result = _documentsSession
    .Query<MessageStatisticResult, MessageSummaryByUserIndex>()
    .Customize(x => x.Include("users/" + command.UserName))
    .Where(x => x.Email == command.UserName)
    .FirstOrDefault();

var user = _documentSession
    .Load<IUser>("users/" + command.UserName);


The final answer was to delete my RavenDB code and reclone from git and rebuild. Then it worked just fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消