is it possible to load EF metadata at runtime?
I 开发者_JAVA百科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?
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.
精彩评论