Forgive me for being too lazy to really read into this, but what are you trying to do? I'm a little confused.
Here's what I see:
Quote:
/* you create a new criteria for type Track off the session...okay */
ICriteria criteria = Session.CreateCriteria(typeof(Track));
/* looks like you want to add selection rules to the criteria based on a rules collection */
int counter = 0;
foreach (SelectionRule selectrule in rule.Selectionrules)
{
/* ignore */
//criteria.CreateAlias("criteria", String.Format("Crit{0}", counter));
/* You create a new criteria for type criteria with an alias of Crit1 [2,3,etc.] */
criteria.CreateCriteria("criteria", String.Format("Crit{0}", counter))
//.CreateCriteria(String.Format("Crit{0}", counter))
/* Match where criteria.id = selectRule.Id? */
.Add(Expression.IdEq(selectrule.Id));
/* increase counter for alias */
counter++;
}
i get the follow exception:
duplicate association path: criteria
okay sure that only 1 is possible so i though using aliases but that also didn't work so how is possible to do this?
Thoughts:
1. Question, do you have an object named criteria?
2. "duplicate association path: criteria", yes, because you are creating multiple aliases for the same type "criteria".
3. Maybe you meant something like selectRule.Criteria, {alias}
4. Perhaps we could help witha little more information about what your intent is.