Say we have a field that can be of more than one type, for example: string or date or XML data types.
Now we have two ways to store this in the database.
1- using a string typed field + a field defining a type: losing sorting by type, listing is required
2- separate tables (StringValues, DateValues, Decimal, XML ... etc.): a foreign key indicating the type of value + field: somehow complex, performance
the second method may have an additional advantage if only unique values ββwere stored: it will work as an index.
Do you have something in mind?
Note1: It is recommended to consider a project based on MS SQL Server 2008 and Linq2SQL
Note2: Perhaps we will discuss how to implement EAV in another question, I ask about EAV in relational storage.
Note3: Types may change, but not often
source
share