I have a CTE that returns the following table:
m_ids |gp_id |id |m_id |id |type|id |type|qty|... ------|------|---|-----|---|----|---|----|---|---
m_id were used for join and have to be removed. The data then goes to the cliend side where Dapper will take care of ambiguity of column names, so that's not a problem.
The problem is how to remove certain columns from the data, because dapper will look on the order of columns in order to create entities.
I can't just select all required columns because of there's a lot of same names (and even if I could, that might be a bad idea because there is A LOT of columns that I need).
Can anyone help me with that?
The order of data have to be preserved, and in the end it should look something like that:
id |id |type|id |type|qty|... ---|---|----|---|----|---|---
EDIT: The query that returns that data looks somewhat like this:
select m1.*, m2.* from pairs p inner join materials m1 on m1.id=p.id1 inner join materials m2 on m2.id=p.id2
As it turned out, when returning multiple entities in one row, Dapper uses the columns
id as a delimiter, so the trick was to make sure that all the excessive columns are placed somewhere in the end of any entity, and Dapper will ignore it. So I put these columns in the order like that and that's it:
id |id |type|m_ids |gp_id |m_id |id |type|qty|... ---|---|----|------|------|-----|---|----|---|...