Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Filters that support different entities
 

Pages: 1
LLBLGen Pro Runtime Framework
Filters that support different entities
Page:1/1 

  Print all messages in this thread  
Poster Message
alexdresko
User



Location:
Greenville, SC
Joined on:
08-Jun-2004 17:30:02
Posted:
336 posts
# Posted on: 30-Jan-2007 21:09:04.  
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...

Code:

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?
I'm not a player, I just code a lot.   Top
alexdresko
User



Location:
Greenville, SC
Joined on:
08-Jun-2004 17:30:02
Posted:
336 posts
# Posted on: 31-Jan-2007 00:12:19.  
Maybe one one replied because they realized I wasn't thinking clearly... derrrrr...

Code:

public PredicateExpression GetSpecialFilter(EntityField myField)
{
PredicateExpression filter = new PredicateExpression();
filter.Add(myField = "N");
filter.Add(myField = "X");
return filter;
}


I'm not a player, I just code a lot.   Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37372 posts
# Posted on: 31-Jan-2007 10:04:23.  
No, you were posting in-between forum monitoring slots Wink. Glad you sorted it out Regular Smiley
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.