文件结构:
class UserAccountInfo
{
public String Id { get; set; }
public AccountType AccountType { get; set; }Servicetax
public String MainAccountMobileNo { get; set; }
public UserStatus Status { get; set; }
public String EmailId { get; set; }
public String DisplayName { get; set; }
**public Object User { get; set; }**
}
对象存储帐户类型中提到的任何类型的实例。可以使用Accountype for ex找到存储在对象中的类型;如果Accountype是customer,那么存储在对象中的实例将是AccountinfoCustomer,依此类推。所以使用我试图查询但从raven获得以下异常。
var Result = sess.Query<UserAccountInfo>().Where(x => x.AccountType == usertype && ((AccountInfoCustomer)x.User).Customerstatus == CustomerStatus.Pending);
{“Url:\”/ indexes / dynamic / UserAccountInfos?query = AccountType%253ADistributor%2520AND%2520User).Customerstatus%253APending&amp; start = 0&amp; pageSize = 128&amp; aggregation = None \“\ r \ n \ r \ n \ nSystem.ArgumentException:字段')_Customerstatus'未编入索引,无法查询未编入索引的字段\ r \ n在Raven.Database.Indexing.Index.IndexQueryOperation.AssertQueryDoesNotContainFieldsThatAreNotIndexes()
答案 0 :(得分:0)