Get Tables and Relationships

前端 未结 1 827
长情又很酷
长情又很酷 2020-12-20 06:26

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

1条回答
  •  时光说笑
    2020-12-20 07:13

    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())
    {
        ...
    }
    
    // Relations
    foreach (var association in itemCollection.GetItems())
    {
        ...
    }
    

    0 讨论(0)
提交回复
热议问题