I just went deep into NHibernate, and I am having problems with one of the more difficult questions (to me!) That I have to write. Scenario:
I have a Staff object that has a Skills collection. I would like to pass the list of “Skills” for the request (for example, if I want only people who can either “Smoke”, or “Code”, or both) and return the list of relevant employees, but I have a bit of a problem ....
What I have objectively:
public class StaffMember : Resource
{
public virtual string EmployeeId { get; set; }
public virtual bool IsTeamLeader { get; set; }
public virtual StaffMember TeamLeader { get; set; }
public virtual IList<Skill> Skills { get; set; }
}
public class Skill : BaseDomainObject
{
public virtual string Name { get; set; }
}
And I think that SQL will look something like this:
select distinct st.*
from staff st, resource re
inner join staffskills sks on re.id = sks.staffresourceid
inner join skill ski on ski.id = sks.skillid
where st.resourceid = re.id
and ski.id in (1,2,3,4)
"Expression.InG" ( "" , skillsSearchList) " , , (, , !)... ?