SQL to LLBL Equivalent

Posts   
 
    
jvidal
User
Posts: 37
Joined: 17-Sep-2007
# Posted on: 20-Mar-2008 19:06:52   

Hi

I'm using LLBLGen Pro 2.5 to create our DAL with self servicing.

What it is, in your opinion, the best way to model the following SQL using the generated DAL?

   _conn = new OracleConnection();
            _conn.ConnectionString = "...";
            _conn.Open();
            OracleCommand cmd = _conn.CreateCommand();

            cmd.CommandText =@"
                
                      Select a.name as Artist,
                                 r.title as Title, 
                                 a.image_set_id as ArtistImageSet,
                                 r.IMAGE_SET_ID as ReleaseImageSet 
                       FROM ARTIST a, 
                                RELEASE r 
                        WHERE
                                r.id='101' 
                                AND 
                                r.primary_artist_id = a.id
                        
                       ";       

            OracleDataReader reader = cmd.ExecuteReader();  
           etc...

I know I can create a predicate bucket to return all the Artists or all the Releases that follow the where clause, but doing this I won't have fields of both objects, just Artists objects or Release objects and I'll need to run another select to the DB to get the other fileds.

I've seen as well that you've implemented the TypedLists that can model this samble sql, but the thing is that I'll have to maintain a TypedLists for each distinct SQL select clause on our application, right?

In summary I'd much appreciate your advice on the best approach to this problem.

Thanks very much Jaume

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 21-Mar-2008 09:35:32   

Use a DynamicList.

Refer to the manual's section: Using the generated code -> SelfServicing -> Using TypedViews, TypedLists and Dynamic Lists -> Using dynamic lists