I have a query like this:
var query = scope.Session.QueryOver<Task>().Where(s => s.Code == code && s.Flag == flag && s.Antry != null);
I have a second query:
var personQuery = scope.Session.QueryOver<Person>();
The query has a field id, which corresponds to an id in the personQuery.
What I want is to make personQuery only contain ids that are present in the query. So far, I have been doing this:
int[] arr = query.Where(i=> i.Id!=null).List<int>().ToArray();
entryQuery.Where(i => i.Id.IsIn(arr));
But, I think this will fail because I know that:
query.Where(i=> i.Id!=null).List<int>().ToArray();
will not return an integer array but an object of query.
So how can I only get the integer’s id in the query?
To get only the integers id’s from the query, you can select an anonymous type with only the properties you are interested in something like: