更改EF模型并在运行时创建新实体 [英] Changing EF Model and creating new entities in runtime
问题描述
我需要设计动态表单生成器。
我决定由用户从表单设计中创建一个表,然后在运行时更新我的EF模型,在运行时生成POCO对象和biz逻辑,然后在运行时编译它们。
我有运行时更新模型的问题。任何帮助?
提前感谢
-Hamid
p> EF不是你的问题的工具! EF围绕简单的概念构建 - 映射和类在设计时定义。如果你想做任何事情,EF不适合你,因为你不会使用EF =不支持/意外的行为/意外的挑战,并且复杂性和成本的大幅增加。
您需要使用直接SQL来处理动态创建的表,或者您需要在设计阶段花费更多时间,并构建元模型,该模型将包含在设计时定义的静态表,能够持有任何形式的表格。
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
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.
这篇关于更改EF模型并在运行时创建新实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!