添加动态表在MVC实体框架 [英] Add table dynamically in Entity framework in MVC

查看:133
本文介绍了添加动态表在MVC实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MVC应用程序中,我需要添加表动态即表名是动态ppared $ P $。有没有什么办法,我们可以检查表的存在,如果不存在然后将其添加在实体模型。

I have an MVC application in which i need to add the table dynamically i.e table name is prepared dynamically. Is there any way we can check for the existence of a table and if not exist then add it in entity model.

如果我们能够创建表,然后我们如何能够利用实体模型的对象访问动态创建的表名?

If we can are able to create the table then how we can access the dynamically created table name using the object of entity model?

推荐答案

没有。如果你想在EF使用新表时,还需要相关的实体(类),映射和暴露对象集在上下文。 <一href=\"http://stackoverflow.com/questions/5268993/how-to-persist-a-type-created-at-runtime-using-entity-framework\">Here你有一些想法是什么意思使用EF动态的做法。

No. If you want to use new table in EF you also need related entity (class), mapping and ObjectSet exposed in your context. Here you have some ideas what does it mean to use "dynamic" approach in EF.

这篇关于添加动态表在MVC实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆