/// <summary> /// Gets the extension dictionary. /// </summary> /// <param name="dbObj">The database object.</param> /// <param name="openMode">The open mode.</param> /// <returns> /// The existing extension dictionary or creates and add one if needed. /// use <see cref="HasExtensionDictionary" /> if only checking to see if it exist is needed /// </returns> public static DBDictionary GetExtensionDictionary(this DBObject dbObj, OpenMode openMode = OpenMode.ForRead) { if (!HasExtensionDictionary(dbObj)) { if (!dbObj.IsWriteEnabled) { dbObj.UpgradeOpen(); } dbObj.CreateExtensionDictionary(); } return dbObj.ExtensionDictionary.GetDBObject<DBDictionary>(openMode); }
/// <summary> /// Gets the extension dictionary identifier. /// </summary> /// <param name="dbObj">The database object.</param> /// <returns></returns> public static ObjectId GetExtensionDictionaryId(this DBObject dbObj) { ObjectId id; if (!dbObj.TryGetExtensionDictionaryId(out id)) { if (!dbObj.IsWriteEnabled) { dbObj.UpgradeOpen(); } dbObj.CreateExtensionDictionary(); id = dbObj.ExtensionDictionary; } return id; }