1

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

John Saunders
  • 160,644
  • 26
  • 247
  • 397
user472292
  • 1,069
  • 2
  • 22
  • 37

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
  • 360,892
  • 59
  • 660
  • 670