.net - Merge Two or More Entity Framework Entities with Dynamic Columns? -


i've got project uses sqlite database entity framework , vb.net. database complex set accessing data in individual tables.

what need way transform (pivot?) data 2 or more tables , resulting table columns generated dynamically based on data in original tables. example, if start 2 tables this:

table 1 id      data    field 1       17      1 1       34      2 1       72      3 2       23      1 2       11      2 2       46      3 3       1       1 3       19      2 3       24      3  table 2 id      data    field 1       abc     4 1       def     5 1       ghi     6 2       jkl     4 2       mno     5 2       pqr     6 3       stu     4 3       vwx     5 3       yz      6 

i need end following resulting table:

id  field1  field2  field3  field4  field5  field6 1   17      34      72      abc     def     ghi 2   23      11      46      jkl     mno     pqr 3   1       19      24      stu     vwx     yz 

simplified, obviously, hope general layout clear. @ design time not know how many fields (and columns in resulting merged table) there be. know, however, data in table 1 numeric , data in table 2 text.

obviously can loop through data , construct datatable dynamically in code, i'm trying figure out if there's more efficient way it, can used data binding datagrid. i've tried various linq joins (using system.linq.dynamic) run problems fact don't know how many of fields there be.

another important factor data need editable, when user updates value i'll need have way figure out row in original table being edited.

does have ideas?


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -