开发者

Add table dynamically in Entity framework in MVC

I have an MVC application in which i need to add the table dynamically i.e table name is prepared dynamically. Is the开发者_Go百科re 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?


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.


Why not create a KeyValuePair<MyTableProperties, List<MyObjects>> in the controller, or viewmodel for that matter, then make a strongly typed view and create the table in there depending of the value of the keyvaluepair object. Or are you talking about some other sort of table?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜