我使用的是VS2010,EF4.0.需要如下功能.
private string[] GetNaviProps(Type entityType)//eg typeof(Employee)
{
NorthwindEntities en = new NorthwindEntities();
//here I return all Properties only for example
return entityType.GetProperties().Select(p=>p.Name).ToArray();
//should return Orders,Territories...
}
Run Code Online (Sandbox Code Playgroud)
我已经检查了这个,但IObjectContextAdapter在EF6.0和.net4.5中看起来很像.我试着像它一样替换它
var workspace = en.MetadataWorkspace;
Run Code Online (Sandbox Code Playgroud)
所以它可以编译,但是然后在第3行抛出异常.
有帮助吗?