Most straightforward way of getting field name (string) from field index (enum)

Posts   
 
    
saggett
User
Posts: 50
Joined: 12-Nov-2007
# Posted on: 03-Nov-2008 18:02:45   

Using LLBLGen 2.6, Adapter pattern, .NET 3.5.

At the moment I've got:

IEntityFields2 fields = EntityFieldsFactory.CreateEntityFieldsObject(EntityType.SensitivityEntity);
return fields[(int)SensitivityFieldIndex.CustomerProfileTypeId].Name;

But is there a way of getting a field name (string) using one of the field enums without creating IEntityFields2 objects?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Nov-2008 06:20:39   

Some ways I can think:

string name = CustomersFields.Address.Name;

string name = SensitivityFieldIndex.CustomerProfileTypeId.ToString();

IEntityFields2 fields = EntityFieldsFactory.CreateEntityFieldsObject(EntityType.SensitivityEntity);
string name = fields[(int)SensitivityFieldIndex.CustomerProfileTypeId].Name;
David Elizondo | LLBLGen Support Team