Hi, I am using the EntityFramework POCO adapter and since there are limitations to what microsoft gives access to with regards to the meta data, i am manually extracting the information i need out of the xml. The only problem is i want to get the ssdl, msl, csdl file names to load without having to directly check for the connection string node in app.config. In short where in the ObjectContext/EntityConnection can i get access to these file names? Worst case scenario i need to get the connection name from the EntityConnection object then load this from app.config and parse the string itself and extract the filenames myself. (But i obviously don't want to do that). Thanks
A:
I can think of two ways to use reflection here:
Dig into the EntityConnection. The connection string should be in there somewhere as a private variable.
The EDM metadata files are embedded in the assembly as resources by default. You should be able to reflect the assembly that contains the EDM and pull the files out directly. Use Reflector on your assembly that contains your EDM and you should see the embedded msl, ssdl, an csdl.
I think option 2 is more robust overall.
Dave Swersky
2009-08-20 16:01:59
A:
Have you looked at the ObjectContext.MetadataWorkspace? It's not the easiest library to work with, but I was able to get all of the information that I needed.
Julia Lerman has a good chapter on the subject in her EF book.
TGnat
2009-08-20 16:13:14
Yeah thats the first place I looked. Nothing looks to be exposed there.
2009-08-21 13:01:10
What are you trying to get out of the raw xml files that you cannot get out of the MetadataWorkspace?
TGnat
2009-08-21 14:15:29