绑定完请刷新页面
取消
刷新

分享好友

×
取消 复制
RavenDb使用
2022-04-14 11:14:01
在Raven中查询数据,查询条件必须在index中。

如果查询条件不在index中就会出现如下异常

  1. var query = session.DynamicIndexQuery<ServiceProviderCallTransaction>()
  2. .Where(x => x.LocationId == request.Id).ToList()

System.ArgumentException: The field 'LocationId' is not indexed, cannot query on fields that are not indexed

在Raven中创建Index

public class App_ActivityLog : AbstractIndexCreationTask<ActivityLog>
    {
        public App_ActivityLog()
        {
            Map = records => from record in records
                             select new
                             {
                                 Id = record.Id,
                                 ClientId = record.ClientId,
                                 ActivityDate = record.ActivityDate,
                                 CategoryId = record.CategoryId,
                                 NameId = record.NameId,
                                 StaffId = record.StaffId,
                                 Status_Value = record.Status.Value,
                                 LocationId = record.LocationId,
                                 ProcedureCode = record.ProcedureCode,
                                 Affiliation_Value = record.Affiliation.Value,
                                 SourceReferenceId = record.SourceReferenceId,
                                 ClaimId = record.ClaimId,
                                 ProgramTypeId = record.ProgramTypeId
                             };
        }
    }

转载于:https://www.cnblogs.com/13579net/p/3484059.html

分享好友

分享这个小栈给你的朋友们,一起进步吧。

RavenDB
创建时间:2022-04-14 10:42:51
RavenDB
展开
订阅须知

• 所有用户可根据关注领域订阅专区或所有专区

• 付费订阅:虚拟交易,一经交易不退款;若特殊情况,可3日内客服咨询

• 专区发布评论属默认订阅所评论专区(除付费小栈外)

技术专家

查看更多
  • gaokeke123
    专家
戳我,来吐槽~