- 积分
- 24557
- 明经币
- 个
- 注册时间
- 2004-3-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2009-8-28 16:58:00
|
显示全部楼层
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=76123
看这段- //编组字典
- #region GroupDictionary
- public DBDictionary OpenGroupDictionary(OpenMode openmode)
- {
- m_GroupDictionary =
- (DBDictionary)m_Transaction.GetObject(
- m_Database.GroupDictionaryId,
- openmode,
- false);
- return m_GroupDictionary;
- }
- public DBDictionary OpenGroupDictionary()
- {
- return OpenGroupDictionary(OpenMode.ForWrite);
- }
- public
- ObjectId AddGroup(string name, ObjectIdCollection ids)
- {
- if
- (m_GroupDictionary.Contains(name))
- {
- return
- ObjectId.Null;
- }
- else
- {
- m_GroupDictionary.UpgradeOpen();
- Group g =
- new Group();
- g.Append(ids);
- m_GroupDictionary.SetAt(name, g);
- m_Transaction.AddNewlyCreatedDBObject(g, true);
- return g.ObjectId;
- }
- }
- public List<Group> GetGroups(Entity ent)
- {
- List<Group> gs =
- new List<Group>();
- foreach
- (DBDictionaryEntry obj in m_GroupDictionary)
- {
- Group g =
-
- (Group)m_Transaction.GetObject(
- obj.Value,
- OpenMode.ForRead,
- false);
- if
- (g.Has(ent))
- gs.Add(g);
- }
- return gs;
- }
- #endregion
复制代码 |
|