Foreign Key Relationships in DataGrid

Posts   
 
    
zgar
User
Posts: 10
Joined: 17-Jul-2008
# Posted on: 31-Jul-2008 00:58:23   

I am using LLBLGen Pro 2.5 with VS 2005 and I wanted to do see if I could get some advice on something simple. I am not sure what is the best technique to use in order to retrieve foreign key values. For a simple example: if a Customer table is displayed in a WebGrid and each entry holds a key to an Order table. I want to display the Name field from the Order table in the grid (rather than the foreign key). I know a few different ways to do this, but I am not sure what is the best to use in terms of overhead etc. I know I could create a typed list, or retrieve the values manually, or use a dynamic list (although I am not having much luck with them). I am new to this and am not sure what would be the best choice, so I was hoping someone could offer some advice/examples.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 31-Jul-2008 05:42:10   

Hi zgar, the are the most used options:

A. EntityCollection + FieldOnRelatedEntity

B. EntityCollection + bind the related entity field

C. TypedList

D. DynamicList

Use A or B if you need two-way databinding (Fetch, then Edit, then Save changes), otherwise use C or D which are read-only. If you will use that structure in many places at code and it's pretty simple, C is recommended. At the other hand, you could build the structure in-memory (option D) which allows you to do almost anything (grouping, sorting, filtering, aggregates, relations, etc).

David Elizondo | LLBLGen Support Team
zgar
User
Posts: 10
Joined: 17-Jul-2008
# Posted on: 31-Jul-2008 22:37:36   

Thank you for the help and the quick response!