Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework : Add Properties/Entities during runtime

I want to use the entity framework. However I also have the requirement of allowing my users to define custom fields in our system. I would like to still use the entity framework and not use a a partial class with a hash table property.

Below is the solution I was thinking of, however it is not simple so I would like to see if there is a better way.

My idea currently, is to have a ModelManager object that would create a column on the appropriate table, modify the EDM files, and compile the files using the edmgen.exe. This would all have to happen in a different process and/or appdomain than the application, since the application would reference the resulting assembly. When the application restarts it will have access to the newly added field.

Is this the only way to do this with the Entity Framework? Thanks for your time.

like image 827
CoderGuy Avatar asked Jan 24 '09 22:01

CoderGuy


1 Answers

After reading some blog entries by the Entity Framework team and Julie Lerman, it sounds like they are looking at making this easier for the next version. Which means as far as I can tell, the way I stated in the question is the best way to dynamically add fields to the entity framework.

like image 176
CoderGuy Avatar answered Oct 06 '22 01:10

CoderGuy