在C#中使用Nhibernate criterian筛选多个值



我在c#代码中使用nHibernate的条件Restrictions来根据特定值进行筛选。目前我无法过滤多个。我试过几种选择,但都不起作用。我基本上想过滤LiquidityCoverageRatio和Basel。我该怎么做

public IList<AldbReport> FindAllByReportSet(AlEtlRunContext runContext, string reportSet)
{
reportSet = reportSet == "LiquidityCoverageRatio" ? "LiquidityCoverageRatio || Basel" : "";
//reportSet1 = reportSet == "Basel" ? "LiquidityCoverageRatio" : "";
var criteria = CreateCriteria(runContext)
.Add(Restrictions.Eq("ReportSet",  reportSet))
//.Add(Restrictions.Eq("ReportSet", reportSet1))
.AddOrder(Order.Asc("Name"));
return criteria.List<AldbReport>();
}

我已经尝试了以下选项

reportSet = reportSet == "LiquidityCoverageRatio" ? "LiquidityCoverageRatio || Basel" : "";
reportSet = reportSet == "LiquidityCoverageRatio" ? "LiquidityCoverageRati,Basel" : "";
and also two restrictions where reportSet1 would be the second value
.Add(Restrictions.Eq("ReportSet",  reportSet))
.Add(Restrictions.Eq("ReportSet", reportSet1))
string reportSet1 = reportSet == "Basel" ? "LiquidityCoverageRatio" : "";
var criteria = CreateCriteria(runContext)
.Add(Restrictions.Or(
Restrictions.Eq("ReportSet",  reportSet),
Restrictions.Eq("ReportSet", reportSet1)
))
.AddOrder(Order.Asc("Name"));
return criteria.List<AldbReport>();

相关内容

  • 没有找到相关文章

最新更新