Changing EF Model and creating new entities in runtime

若如初见. 提交于 2019-12-12 02:57:54

问题


I'm using EF4 in model (DB First), POCO in entities, ASP.Net in UI. I have a Biz layer of course. I need to design dynamic form generator. I decide to create a table from forms design by users, and then update my EF model in runtime, generate POCO objects and biz logic in runtime, and then compile them in runtime.

I have problem about updating model in runtime. any help?

Thanks in advance -Hamid


回答1:


EF is not tool for your problem! EF is build around simple concept - mapping and classes are defined at design time. If you want to do anything else EF is not for you because you are going to not supposed way of using EF = no support / unexpected behavior / unexpected challenges and big increase in complexity and costs.

You need either to use direct SQL to work with your dynamically created tables or you need to spend much more time in your design phase and build meta model which will consist of set of static tables defined in design time which will be able to hold any kind of your form.



来源:https://stackoverflow.com/questions/10308853/changing-ef-model-and-creating-new-entities-in-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!