ormjoinllblgenpro

Inner joins using LLBLGen?


How could I do a simple join using LLBLGen?

table1 - clientTable (address, phone, etc) table2 - employeeTable (name, etc) table3 - clientEmployeeTable (clientid, employeeid)

I'm filling out a datagrid using the employeeId with fields for the client information (address, phone, etc) and I'm not sure how I could retrieve this using LLBLGen. I suppose I could create a stored procedure but maybe there's an easier way?

I'm completely new with LLBLGen.

I've been using stored procedures meanwhile but maybe there's a better way.

// in stored proc

SELECT (my specific fields)
FROM [client].[List] abl
    INNER JOIN [client].ClientGroup cg ON cg.ClientGroupId = abl.ClientGroupId


// in code 
DataTable dt=RetrievalProcedures.GetEmployeeNote(EmployeeId);
rgridNotes.DataSource = dt;

Solution

  • You probably want to create some 'fields on related fields'. You can add ClientGroup properties to the Client entity to access them transparently. This only works for directly related fields in an (m:1) relation. If you want to join deeper than that, you have to use typed lists.

    When you fetch entities and you want to join because of the where statement, you can use relations to join the tables and build a predicate.

    Regards