1
我正在開發一個項目。我有以下型號不支持的表達式類型:System.Linq.Expressions.TypedParameterExpression
public class RegistrantClass : IRavenEntity
{
public RegistrantClass()
{
RegistrantId = new List<string>();
}
public int Id { get; set; }
public IList<String> RegistrantId { get; set; }
public String ClassId { get; set; }
}
和我有以下指標定義
store.DatabaseCommands.PutIndex("RegistrantClass/ClassByStudents",
new IndexDefinitionBuilder<RegistrantClass>
{
Map = students => from i in students
from j in i.RegistrantId
select new { j }
});
我嘗試查詢上述指標像這樣
public object GetMapping(string registrantId)
{
var mapping = _session.Query<RegistrantClass>("RegistrantClass/ClassByStudents")
.Customize(i => i.Include<RegistrantClass>(k => k.RegistrantId))
.Customize(i => i.Include<RegistrantClass>(k => k.ClassId))
.FirstOrDefault(m => m.registrantId.Contains(registrantId));
return mapping;
}
但後來我得到的錯誤信息
但是,這給了我NotSupportedException:方法不支持:包含。
我試着用下面的代碼
.FirstOrDefault(m => registrantId.In<string>(m.RegistrantId));
但後來我得到了以下錯誤消息
Expression type not supported: System.Linq.Expressions.TypedParameterExpression
還有什麼我做錯了。親切的問候