Dynamically Getting (Non-Dynamic) Typed List Fields

Posts   
 
    
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 02-Apr-2005 20:51:10   

I know, confusing subject line. simple_smile

I am just starting to play with generated typed lists, so this might be an easy question.

Here is what I know you can do:


                    case (int)LookupType.Permission_Lookup:                     
                        PermissionListTypedList typedList = new PermissionListTypedList();
                        fields = typedList.GetFieldsInfo();
                        relations  = (IRelationPredicateBucket)typedList.GetRelationInfo();
                        break; 


Here is what I'd like to do:


                case (int)LookupType.Permission_Lookup:                     
                    TypedListBase typedList = new PermissionListTypedList();
                    break;

                //then somewhere outside of the switch statement:
                fields = typedList.GetFieldsInfo();
                relations  = (IRelationPredicateBucket)typedList.GetRelationInfo();

I realise that this doesn't work because the GetFieldsInfo() and GetRelationsInfo() methods are not on the TypedListBase class.

The general problem I am trying to solve: dynamically retrieve a (non dynamic simple_smile ) typed list.

Is there another way I could do this, short of writing concrete field creation methods for each typed list? There are factories for TypedView fields and Entitiy fields, but not TypedList fields, right?

Thanks in advance for any help.

Phil

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 03-Apr-2005 11:25:34   

You should use the ITypedListLgp2 interface simple_smile Cast the typed list to that interface and you can call GetFieldsInfo() and GetRelationInfo() simple_smile

Frans Bouma | Lead developer LLBLGen Pro
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 03-Apr-2005 17:10:00   

Otis wrote:

You should use the ITypedListLgp2 interface simple_smile Cast the typed list to that interface and you can call GetFieldsInfo() and GetRelationInfo() simple_smile

Aha! smile

As always, many thanks for the timely response.