0
我原來的問題可以在這裏找到: RavenDB Index Query QuestionRavenHQ索引查詢返回(500)內部服務器錯誤
我現在使用以下指數偉大的工作:
public class JobsQueuedListCurrent : AbstractIndexCreationTask<AppointmentReminder, JobsQueuedListCurrent.IndexResult>
{
public class IndexResult
{
public int Id { get; set; }
public DateTime AppointmentDateTime { get; set; }
public ReminderStatus ReminderStatus { get; set; }
public DateTime JobDateTime { get; set; }
public JobStatus JobStatus { get; set; }
}
public JobsQueuedListCurrent()
{
Map = appointmentreminders => from appointmentreminder in appointmentreminders
from job in appointmentreminder.NotificationJobs
where (appointmentreminder.ReminderStatus != ReminderStatus.Confirmed)
select new
{
Id = appointmentreminder.Id,
AppointmentDateTime = appointmentreminder.AppointmentDateTime,
ReminderStatus = appointmentreminder.ReminderStatus,
JobDateTime = appointmentreminder.AppointmentDateTime.AddDays(job.DaysOffset),
JobStatus = job.JobStatus
};
Store(x => x.AppointmentDateTime, FieldStorage.Yes);
Store(x => x.ReminderStatus, FieldStorage.Yes);
Store(x => x.JobDateTime, FieldStorage.Yes);
Store(x => x.JobStatus, FieldStorage.Yes);
}
}
我從移動我的代碼我的本地機器AppHarbor和RavenHQ。我現在可以連接並查詢Appharbor和RavenHQ中的正常數據。我的控制器看起來像:
public ActionResult GetJobsQueuedListCurrent()
{
var jobsqueuedlist = RavenSession.Query<JobsQueuedListCurrent.IndexResult, JobsQueuedListCurrent>()
.OrderBy(x => x.AppointmentDateTime)
.As<AppointmentReminder>()
.Take(20)
.ToList();
return View("List", jobsqueuedlist);
}
這工作正常,當我添加以下WHERE子句:
.Where(x => (x.JobDateTime <= DateTime.Now))
使控制器的樣子:
public ActionResult GetJobsQueuedListCurrent()
{
var jobsqueuedlist = RavenSession.Query<JobsQueuedListCurrent.IndexResult, JobsQueuedListCurrent>()
.Where(x => (x.JobDateTime <= DateTime.Now))
.OrderBy(x => x.AppointmentDateTime)
.As<AppointmentReminder>()
.Take(20)
.ToList();
return View("List", jobsqueuedlist);
}
現在這導致一個錯誤(500):內部服務器錯誤,到輸出的pastebin的鏈接如下:
我該怎麼做才能讓查詢在Where子句中使用datetime?順便說一下,我正在使用客戶端的最新不穩定版本(1.2.2139-不穩定)與RavenHQ交談。謝謝。
對,我會用更具體的問題來問我的問題,謝謝。 – mcbowes