I do not think that you can use EF or another ORM structure without changes. You will need special code, but we like to create new things, right?
I see two not very bad solutions:
1) Like your 1. solution, use 2 tables, one with the definition of the columns and the second for the data. For example, a definition table might look like this:
Name Type Description
MyColumn1 int int column
MyColumn2 string string column
The data table contains common columns with names filled with actual data.
Col1 col2
1 string 1
2 string 2
When you request your "data type", you read the "definition" and then request the actual data. You can store additional attributes in the definition table, for example, validators ...
3) If you use MS SQL> = 2008, the third solution looks like a good one. I still recommend a separate table for each data type.
I do not recommend solution 2, it seems like a bad hack. Solution 4. looks clean, but this approach is not suitable for large data sets.
source share