I have this method, receive a list of integer, and must return an Collection of EmployeeComments, the problem is I don’t know how take each result of the criteria and Add to the List of EmployeeComments:
public ICollection<EmployeeComments> GetAllEmployeeCommentsByIdEmployee(List<int> idEmployeeList)
{
List<EmployeeComments> employeeCommentsList = new List<EmployeeComments>();
using (ISession session = NHibernateSessionBuilder.OpenSession())
{
foreach (int idEmployee in idEmployeeList)
{
employeeCommentsList = session
.CreateCriteria(typeof(EmployeeComments))
.Add(Restrictions.Eq("IdEmployee", idEmployee)).List<EmployeeComments>();
}
return employeeCommentsList;
}
}
how can I do this?
In this case you should use Restrictions.In as follows: