1

Is there a way to get a list of tables and relationships from an EDMX using the MetadataLoader?

John Saunders
  • 159,224
  • 26
  • 237
  • 393
user472292
  • 1,039
  • 2
  • 21
  • 35

1 Answers1

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
  • 355,666
  • 57
  • 651
  • 662