zoukankan      html  css  js  c++  java
  • RavenDb使用

    在Raven中查询数据,查询条件必须在index中。

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

                    var query = session.DynamicIndexQuery<ServiceProviderCallTransaction>()
                                        .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
                                 };
            }
        }
  • 相关阅读:
    深入浅出数据库索引原理
    Mysql读写分离原理及主众同步延时如何解决
    数据库连接池实现原理
    MySQL 大表优化方案(长文)
    js-ajax-03
    js-ajax-04
    js-ajax-02
    js-ajax-01
    获取html对象方式
    js-事件总结
  • 原文地址:https://www.cnblogs.com/13579net/p/3484059.html
Copyright © 2011-2022 走看看