我在RavenDB 3.0(build 3599)中有以下索引:
from pupil in docs.Pupils
from year in Enumerable.Range(pupil.BirthAcademicYear, 12)
select new {
pupil.Upn,
year
}
失败,返回以下错误消息:
Cannot implicitly convert type 'object' to 'System.Collections.Generic.IEnumerable<object>'. An explicit conversion exists (are you missing a cast?)
此类索引在RavenDB 2.5中有效。发生了什么变化?这是一个新的bug,是否有解决方法?
我尝试将可枚举调用更改为:
Enumerable.Range(pupil.BirthAcademicYear, 12).Select(i => (object)i)
这会导致错误:
'object' does not contain a definition for 'Cast'
答案 0 :(得分:0)
将索引更改为:
from pupil in docs.Pupils
from year in Enumerable.Select(Enumerable.Range(pupil.BirthAcademicYear, 12), (Func<int,object>)(u=> u))
select new {
pupil.Upn,
year
}