获取表和关系 [英] Get Tables and Relationships

查看:154
本文介绍了获取表和关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让使用MetadataLoader从EDMX表和关系的列表?

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

推荐答案

试试这个:

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>())
{
    ...
}

这篇关于获取表和关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆