PredicatedExpression Relationship Bucket from string

Posts   
 
    
BaileyK83
User
Posts: 29
Joined: 30-Dec-2006
# Posted on: 16-Jul-2007 10:37:57   

Before I duplicate code is there anything in LLBL that would:

1.) take a string (like from a sql WHERE statement) and produce a predicate expression

OR

2.) Can you attach a sting sql where statement to an entity collection fetch?

Aurelien avatar
Aurelien
Support Team
Posts: 162
Joined: 28-Jun-2006
# Posted on: 16-Jul-2007 15:58:48   

Hi,

As far I know, there is no way to do both with LLBLGen.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Jul-2007 11:12:56   

I've to correct Aurelien, because both are possible.

BaileyK83 wrote:

Before I duplicate code is there anything in LLBL that would:

1.) take a string (like from a sql WHERE statement) and produce a predicate expression

OR

2.) Can you attach a sting sql where statement to an entity collection fetch?

You can create custom where fragments by using your own class which derives from Predicate and in which you simply output the SQL fragment in the ToQueryText method override. Then in your code, you simply use instances of that class and add these instances to the predicateexpression used in the fetch.

You can also attach Sql fragments by overriding OnFetchEntityCollection in a derived class of DataAccessAdapter (if you're using adapter of course) or a partial class of DataAccessAdapter, and add the sql there, or call to a method which knows which sql fragment to add to the query.

Frans Bouma | Lead developer LLBLGen Pro
BaileyK83
User
Posts: 29
Joined: 30-Dec-2006
# Posted on: 17-Jul-2007 20:05:42   

Thats very exciting, thanks for the great information. My first read didn't quite understand the first part but when I read it again it was perfect and exactly what I want