I use entity framework for a fairly simple issue tracking app. I would like to provide the user the capability to extend the "Issue" entity by adding additional properties such as:
- Number fields
- Text fields (simple or rich text)
- Different lists (multiple\ single select)
- Boolean property
I thought of two ways to accomplish the task:
Extendable Database Approach
This is approach is just and idea and i don"t know how to implement using Entity Framework so i would very much like your help. Here is the basic concept:
- Create a table called IssueExtendedFields that will have a record for each field describing it's type and name and maybe other properties.
- Create another table called IssueFieldOptions that will hold a list of options for each "list type field"
- And the final table caled IssueExtendedFieldValues that will hold a Column with a specific naming convention for each custom field created by the user and a foreign key for each issue..
Now i just don't know how to implement the 3rd step because is use entity framework and there are EF entity objects that are generated out of the tables (DB first) so each new column will theoretical have to re-map and recompile the DAL project.
Do you have any other suggestions?
Dictionary Approach
This approach I know how to implement
- Create a table called IssueExtendedFields that will have a record for each field describing it's type and name and maybe other properties.
- Create another table called IssueFieldOptions that will hold a list of options for each "list type field"
- And the final table called IssueExtendedFieldValues that will hold a record for each "Field - Value" pair that is entered into the system
But it suffers from numerous drawbacks (if you see how to over come them please post).
- Every new property the user adds is just another record multiplies the amount of data stored for each entity by X where X is the number of properties, I see big numbers of issues going into the system and creating a separate table that will hold 10 more records for each issue will generate huge queries that will require a lot of memory.
- On top of the foreseen memory problems I will have to create Dynamic "Pivot" like reports and views to allow the user generating reports again the custom properties, and when you deal with huge amount of data the "Pivot" query will take even more time.