Thanks Frans.
Sorry, I have tried so many variations it's hard to keep them straight.
Here is one that works:
var disciplines = securityContext.CurrentUser.Disciplines;
var jobTypes =
session.CreateCriteria<JobType>().List<JobType>();
return new List<JobType>(from jobType in jobTypes where
disciplines.Contains(jobType.Discipline) select jobType);
Here is your suggestion:
var disciplineIDs =
securityContext.CurrentUser.Disciplines.Select(d => d.Id);
return new List<JobType>(
from jobType in session.Query<JobType>()
where disciplineIDs.Contains(jobType.Discipline.Id)
select jobType);
It fails with a GenericADOException was unhandled:
could not execute query
[ select jobtype0_.Id as Id13_, jobtype0_.LocationTypeId as
Location2_13_, jobtype0_.DisciplineId as Discipli3_13_ from JobType
jobtype0_ where jobtype0_.DisciplineId in (@p0) ]
Name:p1 -
Value:System.Linq.Enumerable+WhereSelectEnumerableIterator`2[PD.Insulation.Domain.Discipline,System.Guid]
[SQL: select jobtype0_.Id as Id13_, jobtype0_.LocationTypeId as
Location2_13_, jobtype0_.DisciplineId as Discipli3_13_ from JobType
jobtype0_ where jobtype0_.DisciplineId in (@p0)]
Here is a variation on your suggestion:
var discipline = securityContext.CurrentUser.Disciplines;
return new List<JobType>(from jobType in
session.Query<JobType>()
where
discipline.Contains(jobType.Discipline)
select jobType);
This one fails with an exception in PolymorphicQuerySourceDetector.cs -
GetClassName with a querySource.Type of ':'.
I am still working on a test case.
On 10-08-06 1:18 PM, Frans Bouma wrote:
Frans,
Yes I did try the following but got the same exception.
var disciplineIDs = securityContext.CurrentUser.Disciplines.Select(d
=> d.Id);
return session.QueryOver<JobType>()
.Where(x => disciplineIDs.Contains(x.Discipline.Id))
.List();
that's a queryover query, I posted a linq query:
var disciplineIDs = securityContext.CurrentUser.Disciplines.Select(d=>d.ID);
return new List<JobType>(
from jobType in session.Query<JobType>()
where disciplineIDs.Contains(jobType.Discipline.Id)
select jobType);
which is not using QueryOver, but the linq provider. It should use a
different codepath in the linq provider.
FB
On 10-08-06 12:19 PM, Frans Bouma wrote:
Did you try the workaround I posted? There are at least 3 kinds of
Contains queries possible, and for the person who's going to pick up
this issue to fix it it's IMHO key that s/he knows what works and what
doesn't so the quest to look whether it is implemented is easier ;)
FB
:) Yes, I got it. I was working on it the whole time but you kept
asking questions.<g>
On 10-08-06 11:19 AM, Fabio Maulo wrote:
To be frankly ? (again)
You can create a failing test and open a new JIRA ticket,
then
we can check which is the problem. (<== time 3)
Ups sorry, it was the time 4
--
Fabio Maulo
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.