How to Return EnumValue as part of Dynamic List

Posts   
 
    
saravana
User
Posts: 63
Joined: 11-Nov-2010
# Posted on: 26-Apr-2011 16:20:45   

I am now building a dynamic list from multiple tables and return this as a DataReader. I will fill the values in the DataReader to my Custom Business object. In my BL I have a Enumuration called TemplateCategory(Template/TemplatePart). I need to return and fill the TemplateCategory property of my business object based the ResultsetFields of the Dynamic Query.

The tricky part here is, I am not having the corresponding value directly stored in the database field. I have to evaluate the TemplateCategory value based on the presence of an Id in any one of the table in the database (tempaltepart/tempalte).

I have Four tables TemplateOrPart, Template,TemplatePart and TemplateOrPartVersion. The table TemplateOrPart has all the IDs generated. If it is a Template then the Id will be stored in TemplateOrPart and Template tables.

If it is a TempaltePart then the Id will be stored in TemplateOrPart and TemplatePart tables. So If a user passes a TempalteId from UI, I have to check in Template and TemplatePart table and set it's category accordingly(TemplateCategory.Template or TemplateCategory.TemplatePart).

Is there any way to evaluate the above TemplateCatgory Enum value within the DynamicList?

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 26-Apr-2011 21:24:49   

2 approaches spring to mind

1) You ould build a view in the database which encapsulates this logic, and then map a TypedView to it in the designer.

2) Investigate the use of Field Expressions http://www.llblgen.com/documentation/2.6/Using%20the%20generated%20code/gencode_expressionsaggregates.htm#expressions which allow you to do this sort of manipulation in code

Matt