is it possible to load EF metadata at runtime?

杀马特。学长 韩版系。学妹 提交于 2019-12-14 03:58:40

问题


I want to load EF metadata from database at runtime. Is that scenario possible? First get the data from database, then write it to .ssdl, .msl and .csdl files sounds ok. But how to tell EF to use what I've loaded? Do I need to compile it or something like that?


回答1:


Yes, you can do that.

New up a MetadataWorkspace using the constructor which takes these files.

Then you can new up an EntityConnection passing the MetadataWorkspace to the overloaded constructor, and finally new the ObjectContext passing that.

With all that said, I wonder if this is the best approach to your problem.



来源:https://stackoverflow.com/questions/2956112/is-it-possible-to-load-ef-metadata-at-runtime

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