LLBLGen v 2.0
XP PRO SP2
VS 2005
C#
We have multiple typed views that contain the same fields from related tables. Is it possible to create a generic mechanism that returns a suitable PredicateExpression regardless of the view? The redundant code that we're writing is a horrible "smell" in my opinion..
More specifically, all of our type views contain a Status property and the filters on this property are fairly complex. I want to create a function like...
public static PredicateExpression GetSpecialRecordsFilter()
{
PredicateExpression filter = new PredicateExpression();
filter.AddWithAnd(SomeTypedViewFields.Status = 'A');
filter.AddWithAnd(SomeTypedViewFields.Status = 'B');
return filter;
}
The problem is, I need to be able to use that function for other typed views and it's tightly bound to "SomeTypedViewFields".
Is this possible?