How to use SQL UDF

Posts   
 
    
avdean_
User
Posts: 5
Joined: 18-Dec-2006
# Posted on: 05-Jan-2007 21:54:40   

I've been evaluating LLBL for a few days and so far so good, but I do have a question regarding UDF functions.

The problem is with a current architecture where entity collections get filtered at the SQL tier using stored procs. In the stored procs a query is joined to a UDF that returns a filtered table thus filtering the collection data. The UDF performs much business logic to filter the data.

Without going into the UDF and redesigning, what is the approach to use LLBL objects to leverage this filter UDF?

Also, how would you perform complex filtering for collections using LLBL?

I'm open to any suggestions...thanks in advance.

PilotBob
User
Posts: 105
Joined: 29-Jul-2005
# Posted on: 06-Jan-2007 00:05:48   

avdean_ wrote:

I'm open to any suggestions...thanks in advance.

Perhaps I missed why you are using SP's. But, the best answer is to use the Dynamic Query generation that LLBLGen is designed for so you get much better performance. This will be MUCH faster than using filtered UDF's.

BOb

Chester
Support Team
Posts: 223
Joined: 15-Jul-2005
# Posted on: 14-Jan-2007 22:26:04   

Look at the documentation section "Using the generated code\Adapter\Filtering and Sorting". Or look in Self-Servicing instead of Adapter if you're using that template set.

In general one of the beautiful things about LLBLGen is that it moves conditional filtering logic to your business layer, which prevents unnecessary logic and data reads on the DB server.