So, I've got a helper method, that does a bunch of logic, that I'm trying to share across a bunch of tables that have a common structure (but different data).
public static void GetTags(string[] tags, int maxTags, TypedListBase2 typedList, IEntityRelation mappingRelation, IEntityField2 mappingField)
{
...
}
In there, I've got some code along the lines of:
IGroupByCollection subGroupByClause = new GroupByCollection();
subGroupByClause.Add(mappingField);
subGroupByClause.HavingClause = new PredicateExpression(mappingField.SetAggregateFunction(AggregateFunction.Count) == tags.Length);
Now, I can't use mappingField twice (because SetAggregateFunction affects the field directly) - I need a different instance of mappingField for the Add(mappingField) and for within the HavingClause.
So I need a way of saying "use this mapping field" . At the moment I can only think of passing in a delegate or something that will create the required entity field? Hoping that's a little clearer... but I fear not!