Mapping an Pivot Query in EntityFramework6

At work I had a challenging problem in the last days (in fact I like challenging problems and they’re not that rare which is why I like my job).

This time the problem was this:

  1. Let T be a table with columns C and X.
  2. Let the column E be of an enum type with a short, static defined values E1, E2, E3.
  3. Let the column X be a space separated list of tokens (values look like „ABC“, „ABC DEF“, „XUT OSH OJR“, with an arbitrary number of tokens).
  4. We look for the following information:
    For a given token x in the values of X get a tuple R = (#(E1), #(E2), #(E3)), where #(Ei) denotes the number of rows in T, where x is included in X and the row has value Ei in column E.

Mapping an Pivot Query in EntityFramework6 weiterlesen