How can a parse the resource file of a program's assembly at run-time and find the MSL metadata for the program's EF model?

  • Thread starter Thread starter RobertGustafson
  • Start date Start date
R

RobertGustafson

Guest
WHAT I HAVE:
Visual Basic 2019, .NET 4.6.1, Entity Framework
MY PROBLEM:
Sometimes it's useful to have a program that an convert conceptual-model info (like entity/property) into corresponding store-model info (like table/column) at run-time. Most versions of EF don't directly provide the mapping data, although one can parse the XML in the MSL metadata file to resolve these relationships. My own self-made tools only work when the MSL file is a separate file copied to the "output directory", and it would nice to be able to find the necessary metadata when it's stored as a resource in the program's exe assembly. What's more, while objects exist in .NET 4.7 to recover the XML for the appropriate metadata, these objects and methods are absent in earlier .NET versions like 4.6.1--which my program needs to be built using (for reasons that aren't important here).

I need to be able to get the resource-file info for the program's assembly (once again, at run-time), and be able to find the appropriate MSL metadata--even when my platform is pre-4.7.

Any stuff for parsing resources in a running app's assembly--as well as stuff for extracting EF metadata from the resources--would be nice. I prefer the code examples clearly show which members should be invoked (and how) to obtain the needed info, and be written in VB.NET. Whatever is given MUST be (source-code) compatible with .NET 4.6.1 (!) and possibly lower (ideally, anything between versions 4.5 and 4.6.1 inclusive).

Please give me a response ASAP. I've asked about this on several post and still haven't gotten a reply. (Once again, it has to a solution that can be invoked at run-time in a project configured for .NET 4.6.1!)

PS. I've also posted this exact same request on the Developer Community (is that what it's called?), but I've only got a reference to a metadata-finder that only works for .NET 4.7. When I said I needed something that worked with earlier platforms, I got no response. I'm prepared to parse internal resources of the project's assembly and look for the metadata manually (as opposed to using a process dedicated to this particular problem), provided I know how. I'd like a simple approach to getting the resource data that I need, that doesn't require me to check several ideas and merge them together myself--since a conceptual-to-store conversion tool is intended as an ancillary, reusable utility library, rather than a full-blown project in its own rite. This is a side issue to my real project, but a necessary one all the same.



Robert Gustafson

Continue reading...
 
Back
Top