Hi all
How can I make a criteria that search in an IDictionary?
I have an object Result
Code:
public class Result
{
private int id;
public virtual int Id
{
get { return id; }
set { id = value; }
}
/// <summary>
/// A mapping of runners -> timespans of their individual time usage
/// </summary>
private IDictionary<Runner, TimeSpan> _individualTimeSpent;
public virtual IDictionary<Runner, TimeSpan> IndividualTimeSpent
{
get { return _individualTimeSpent; }
set { _individualTimeSpent = value; }
}
}
And this mapping file
Code:
<class name="Result" table="Result">
<!-- Id -->
<id name="Id">
<column name="Id" sql-type="int"/>
<generator class="increment" />
</id>
<map name="IndividualTimeSpent">
<key column="ResultId" />
<index-many-to-many
column="KeyId"
class="Project.Model.Runner, Project" />
<element column="ValueTimeSpent" type="TimeSpan"/>
</map>
</class>
I would like to make a criteria where I search in the map. I cannot do something like this:
Code:
ICriteria criteria = GetCriteria();
criteria = criteria.Add(Expression.Eq("IndividualTimeSpent.Runner.Firstname", name));
But i'm not able to. How can I use criteria on IDictionarys?
Thanks for your time,
kind regards
Jacob