I am using entity framework 4.1, an edmx mapping file is used to generate poco classes using T4 templates.
How can I get a name of the data base column out of object context for my poco entity properties (if it is possible at all).
I believe the mapping between properties and columns should be in one of the containers:
var container = objectContext.MetadataWorkspace
.GetEntityContainer(objectContext.DefaultContainerName, DataSpace.CSpace);
...
But I was not able to identify a link between CSpase and SSpace, it looks like CSSpase might do the job, but this container is empty.
Any ideas?
I used a mixed approached to get the mapping information (we have to implement custom data reader/writer for certain types):
First get EntityType object to extract meta information for your POCO type:
Read mapping XML document: this part is basically hardcoded, mapping xml document is saved in the assembly where edmx file is, it’s called [your_edmx_file_name].msl
Read property to column mapping from XML document: