none
Add column dynamic in IQueryAble RRS feed

  • Question

  • Good afternoon.

    I have a selection of data as follows:

    var

    query = from products in db.tblProducts
    from marca in products.tblMarcas
    select (new{
    ItC_Codigo = (int) products.ItC_ID,
    ItC_ Description = produto.ItC_Description,
    ItC_Supplement = produto.ItC_Supplement,
    Mar_Description = (string)marca.Mar_Description
    });

    I would like to add a new column to this selection in order to concatenate field values, however dynamically. For example, a new column called ItC_FullDescription where in a given situation the value would be the concatenation of this both existent fields: products.ItC_ Description + "" + products.ItC_Supplement

    And in another situation, the value of that column could be this other one:
    products.ItC_Description + "" + marca.Mar_Description.

    I used to work with LinqKit to make where clauses dynamically, where I have only one IQueryable like on example and create from a dynamic predicate my desired conditionals for each situation. I wonder if there is no way to add a new column to an existing IQueryable like we already do with the Where on LinqKit.
    I tried to be objective but may not have been clear. Any doubt of who is willing to help I am available.
    Grateful.

    Friday, January 29, 2010 12:32 PM

Answers

All replies