Hi,
I don't know how to explain very well, so let me put a example of what I'm trying to do.
I have a dynamic query such as:
SELECT NM_COMPANY AS Property1, PHONE_COMPANY AS Property2, EMAIL_COMPANY AS Property3, FL_ACTIVE_COMPANY AS Property4, DT_COMPANY AS Propery5 FROM TB_COMPANY --WHERE SomeClausure
This kind of query is read from the database.. Also in the table of that query there's some columns informing the type of those properties used as alias in the query. In this example, I know that Property1 is a name, Property2 is a phone number and Property3 is a email (need to put mask after), Property4 is a flag that I need to convert in string after ("Yes" or "No") and Property5 is a date that I need to use something like '.ToShortDateString()'.
I need to 'translate' all those properties to string in order to show those values to the user.
So, to execute that query:
public class GridDetails { public dynamic Property1 { get; set; } public dynamic Property2 { get; set; } public dynamic Property3 { get; set; } public dynamic Property4 { get; set; } public dynamic Property5 { get; set; } public dynamic Property6 { get; set; } public dynamic Property7 { get; set; } public dynamic Property8 { get; set; } public dynamic Property9 { get; set; } public dynamic Property10 { get; set; } } List<GridDetails> detailsList = DataContext.ExecuteQuery<GridDetails>(queryGrid).ToList();
Ok, so I have a list with a lot of dynamic properties that I need to access in order to 'translate' their values: converting to string, putting mask, using .ToShortDateString()...
How can I do that?
Points:
- Everything come from database, so everything is dynamic. I only need the class 'GridDetails' to execute the query using linq, that's why there are only dynamic properties;
- I have only LINQ in this project