我有以下代码
using (WdmEntities context = new WdmEntities())
{
//get object models from context
ObjectContext objContext = ((IObjectContextAdapter)context).ObjectContext;
var container = objContext.MetadataWorkspace.GetEntityContainer(objContext.DefaultContainerName, DataSpace.CSpace);
List<string> schemas = new List<string>();
foreach (var set in container.BaseEntitySets)
{
foreach (var metaproperty in set.MetadataProperties)
{
//here
if(metaproperty.Name == "Schema")
{
//but metaproperty.Value == NULL
schemas.Add(metaproperty.Value);
}
}
}
}
我得到空值而不是模式名称。我如何从实体框架中获取 shemas 的名称。(在我的数据库中,我有两种不同的 shemas。)也许有人知道另一种方式?