尝试使用 QueryOver 和标记的枚举查询。这适用于 Nhibernate.Linq:
var results = repo.Query()
.Where(x => (x.Classification & LineItemClassification.Shipping) == LineItemClassification.Shipping);
这Could not determine member from (Convert(x.Classification) & 2)
使用 QueryOver 抛出:
var results = repo.QueryOver()
.Where(x => (x.Classification & LineItemClassification.Shipping) == LineItemClassification.Shipping);
有任何想法吗?建议?
枚举:
[Flags]
public enum LineItemClassification
{
Foo,
Widget,
Shipping
}
映射:
Map(x => x.Classification)
.CustomType<LineItemClassification>();