I'm having a class foo like
foo
{
Dictionary<string, Blubb> blubbDict {get;set;}
Dictionary<Bar, string> barDict {get;set;}
}
Now i'd like to load all objects from the database where blubbDict containts a key "FooBar" and where barDict contains any objects Bar which i have locally in a List barList.
What i got so far:
var fooQuery = from c in session.Query<Foo>()
where c.blubbDict.ContainsKey("FooBar")
select c;
which works so far. But what about my last condition. I'd like only the Foo objects where both conditions meet "FooBar" AND the key of barDict is in my local List.
Can anyone help me? I can't get my head around that problem.
Never tried to do it so I'm not absolutely sure Linq For NH supports it but you can try:
var fooQuery = session.Query<Foo>()
.Where(c => c.blubbDict.ContainsKey("FooBar"))
.Where(c => barList.Any(b => c.barDict.ContainsKey(b)));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.