Centralize Prefetch/Filter Code

Posts   
 
    
mshe
User
Posts: 167
Joined: 02-Feb-2006
# Posted on: 04-Feb-2006 21:56:30   

Hi all,

I'm new to LLBLGen ... and I have a question about Prefetch/Filters. Where do you guys place your Prefetch/Filter code? I have a couple objects which use the same prefetch/filter code all over the place - do you just create a private function to call? I'm just looking for a structure which i can use to enforce centralized prefetches for future development (and for other developers to use too).

Thanks.

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 04-Feb-2006 22:03:41   

Do you have a business logic layer (BLL)? Or are you just making calls directly from your UI to the database?

mshe
User
Posts: 167
Joined: 02-Feb-2006
# Posted on: 04-Feb-2006 22:56:41   

Yes, I have a BLL.

For the prefetch, I've declared a variable in my base class to store the prefetch (since prefetch won't change throughout the code).

However, for the filters... how do you handle that?

I have a couple cases where I need to filter on soft deletes (i.e. Deleted = 0), and I like to ensure that this filter is incorporated into all fetch calls in a particular class. Any suggestions on how to do this?

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 05-Feb-2006 02:21:49   

I use a Factory class stored and available in the BL for this purpose. Works very well for us.

Jeff...