How can QueryOver be used to filter for a specific class?

前端 未结 2 329

I am currently dynamically constructing queries like so:

QueryOver q = QueryOver.Of();

if (foo != null) q = q.Where(b => b.         


        
2条回答
  •  太阳男子
    2021-01-13 12:37

    This is not intuitive, but the following should work fine (QueryOver):

    if (bar) q = q.Where(b => b.GetType() == typeof(Derived));
    

    I'm not sure about a way to do this in LINQ-to-NH.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题