Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的 web 应用程序中添加了持久类。它包含20个类..,
在我的 Default.aspx.cs 中,我想从 Persistent 类中的所有类中获取主键名称列表。我怎样才能找到它?
我假设您使用 XPO:
foreach (XPClassInfo classInfo in xpoSession.Dictionary.Classes) { Console.WriteLine(classInfo.FullName + "=" + classInfo.KeyProperty); }
如果您有简单的主键,请使用classInfo.KeyProperty.Name它来获取其名称。
classInfo.KeyProperty.Name