Mapping multiple (two) row into one entity – how to? RRS feed

  • Question

  • Hi,

    is it possible to map two or more rows of a table to one entity?

    The property to chose to map to should depend on some column value.



    ¦ID not PK ¦ Condition ¦ ValueColumn¦


    public class SomeEntity {


      ValueColumnConditionTrue {get; set;}


      ValueColumnConditionFalse {get; set;}



    Thursday, October 18, 2018 8:27 AM

All replies

  • You need to use a DTO.


    Thursday, October 18, 2018 9:32 AM
  • Hi Uzivatel 919,

    Maybe LINQ Pivot Extensions is helpful for you. for more information, please refer to:


    Or loop the table records, assign to one entity via related condition.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, October 19, 2018 1:36 AM