Is there a way to get a list of tables and relationships from an EDMX using the MetadataLoader?
Asked
Active
Viewed 2,322 times
1 Answers
4
Try this:
MetadataWorkspace metadataWorkspace = null;
bool allMetadataLoaded = loader.TryLoadAllMetadata(inputFile, out metadataWorkspace);
StoreItemCollection itemCollection = (StoreItemCollection)metadataWorkspace.GetItemCollection(DataSpace.SSpace);
// Tables
foreach (var entity in itemCollection.GetItems<EntityType>())
{
...
}
// Relations
foreach (var association in itemCollection.GetItems<AssociationType>())
{
...
}

Ladislav Mrnka
- 360,892
- 59
- 660
- 670