예제 #1
0
        /// <summary>
        /// Сохранение в словарь объекта DBObject (ExtensionDictionary)
        /// </summary>
        public static void Save(IDboDataSave obj, Document doc)
        {
            if (doc == null || doc.IsDisposed)
            {
                return;
            }

            var dicEd = obj.GetExtDic(doc);

            if (dicEd == null)
            {
                return;
            }

            using (doc.LockDocument())
                using (var t = doc.TransactionManager.StartTransaction())
                {
                    var idDbo = obj.GetDBObject();
                    if (!idDbo.IsNull)
                    {
                        var dbo = idDbo.GetObject(OpenMode.ForWrite);
                        if (dbo != null)
                        {
                            EntDictExt ede = new EntDictExt(dbo, plugin);
                            ede.Save(dicEd);
                        }
                    }
                    t.Commit();
                }
        }
예제 #2
0
        public static void SaveDboDict([NotNull] this IDboDataSave dboSave)
        {
            var doc = Application.DocumentManager.MdiActiveDocument;

            using (doc.LockDocument())
                using (var dbo = dboSave.GetDBObject())
                {
                    using (var entDic = new EntDictExt(dbo, dboSave.PluginName))
                    {
                        entDic.Save(dboSave.GetExtDic(doc));
                    }
                }
        }