<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Some AutoCAD classes entities as Source for PropertyGrid control = Fatal Err in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2710141#M64928</link>
    <description>&lt;P&gt;Many thanks! Now I understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tell me please, how aright&amp;nbsp;implementation&amp;nbsp;&amp;nbsp;ICustomTypeDescriptor for DBObject?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I write it (russian / english comments):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    public class PropDispNameWrapper : ICustomTypeDescriptor
  {
    // Оборачиваемый объект (source object).
    private object _obj;
    // Коллекция, хранящая обертки над описаниями свойств (collection of description properties).
    PropertyDescriptorCollection _propsCollection;

    // Позволяет получить обернутый объект (get wrapped object).
    public object Unwrap{ get{ return _obj; } }

    public PropDispNameWrapper(object obj)
    {
      // Запоминаем оборачиваемый объект (remember source object link).
        _obj = obj;
        
      // Создаем новую (пустую) коллекцию описаний свойств, 
      // в которую поместим обертки над реальными описаниями (Create new (clear) collection of property descriptions and put wrappers for real descriptions).
      _propsCollection = new PropertyDescriptorCollection(null);
      PropertyDescriptorCollection pdc = 
          TypeDescriptor.GetProperties(obj, true);
      // Перебираем описания свойств, создаем для каждого 
      // из них обертку и помещаем ее в коллекцию (description properties iteration. Create wpapper for each, and add in collection).
      foreach(PropertyDescriptor pd in pdc)
        _propsCollection.Add(new MyPropDesc(pd));
    }

    /////////////////////////////////////////////////////////
    /// ICustomTypeDescriptor
    ///
    System.ComponentModel.AttributeCollection ICustomTypeDescriptor.GetAttributes() 
    {
      return new  System.ComponentModel.AttributeCollection(null);
    }

    string ICustomTypeDescriptor.GetClassName() 
    {
      return null;
    }

    string ICustomTypeDescriptor.GetComponentName() 
    {
      return null;
    }

    TypeConverter ICustomTypeDescriptor.GetConverter() 
    {
      return null;
    }

    EventDescriptor ICustomTypeDescriptor.GetDefaultEvent() 
    {
      return null;
    }


    PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() 
    {
      return null;
    }

    object ICustomTypeDescriptor.GetEditor(Type editorBaseType) 
    {
      return null;
    }

    EventDescriptorCollection ICustomTypeDescriptor.GetEvents() 
    {
      return new EventDescriptorCollection(null);
    }

    EventDescriptorCollection ICustomTypeDescriptor.GetEvents
        (Attribute[] attributes) 
    {
      return new EventDescriptorCollection(null);
    }

    PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() 
    {
      return _propsCollection;
    }

    PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(
        Attribute[] attributes) 
    {
      return _propsCollection;
    }

    object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) 
    {
      return this;
    }
  }

  public class MyPropDesc : PropertyDescriptor
  {

    PropertyDescriptor _PropDesc;

    public MyPropDesc(PropertyDescriptor PropDesc) : base(PropDesc)
    {
      _PropDesc = PropDesc;
    }
    public override string Category{ get{ return _PropDesc.Category; } }
  
    // Это свойство возвращает название свойства, 
    // отображаемое в propertyGrid (It's property, which return displayed property name).
    public override string DisplayName 
    { 
      get 
      {
        // Пытаемся получить атрибут DisplayNameAttribute.
          // В случае неудачи будет возвращен null (try get attribute DisplayNameAttribute. If fail - return null).
        DisplayNameAttribute mna = 
            _PropDesc.Attributes[typeof(DisplayNameAttribute)] as 
            DisplayNameAttribute;
        if(mna != null)
          // Если имеется атрибут DisplayNameAttribute,
            // возвращаем текст, помещенный в него (If DisplayNameAttribute assign, then return text, which in this).
          return mna.ToString();
        // Если атрибут DisplayNameAttribute не задан,
        // возвращаем оригинальное имя свойства (If DisplayNameAttribute not assign, then return original name of property). 
        return _PropDesc.Name;
      }
    }

    public override Type ComponentType 
    {
      get 
      {
        return _PropDesc.ComponentType;
      }
    }

    public override bool IsReadOnly 
    {
      get 
      {
        return false;
      }
    }

    public override Type PropertyType 
    {
      get 
      {
        return _PropDesc.PropertyType;
      }
    }

    public override bool CanResetValue(object component) 
    {
      return _PropDesc.CanResetValue(((PropDispNameWrapper)component).Unwrap);
    }

    public override object GetValue(object component) 
    {
      return _PropDesc.GetValue(((PropDispNameWrapper)component).Unwrap);
    }

    public override void ResetValue(object component) 
    {
      _PropDesc.ResetValue(((PropDispNameWrapper)component).Unwrap);
    }

    public override void SetValue(object component, object value) 
    {
      _PropDesc.SetValue(((PropDispNameWrapper)component).Unwrap, value);
    }

    public override bool ShouldSerializeValue(object component) 
    {
      return _PropDesc.ShouldSerializeValue(
          ((PropDispNameWrapper)component).Unwrap);
    }
  }

  [AttributeUsage(AttributeTargets.Property |
     AttributeTargets.Field)]
  [Serializable]
  public class DisplayNameAttribute : Attribute
  {
    string _sText;
    public DisplayNameAttribute(string Text) : base()
    {
      _sText = Text;
    }
    public override string ToString()
    {
      return _sText;
    }
  }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;but it not correct implementation for DBObject.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jul 2010 09:12:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-07-07T09:12:05Z</dc:date>
    <item>
      <title>Some AutoCAD classes entities as Source for PropertyGrid control = Fatal Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2708467#M64924</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Windows XP SP3 x86 Rus, AutoCAD 2009 SP3 x86 Rus, &lt;FONT color="#008000"&gt;.Net Framework 3.5 SP1, MS Visual Studio 2010&lt;/FONT&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I want use PropertyGrid control in window my AutoCAD plagin's for browse drawing database entities. But it is big problem&lt;FONT color="#FF0000"&gt; in AutoCAD&lt;/FONT&gt;:&amp;nbsp;I have &lt;FONT color="#FF0000"&gt;always fatal error for some AutoCAD entities&lt;/FONT&gt;, when these used &lt;FONT color="#FF0000"&gt;as ObjectSource property for &lt;A rel="nofollow" href="http://visualstudiogallery.msdn.microsoft.com/ru-ru/A7065009-8BDC-4BE1-8674-4CD95D0CC308" target="_self"&gt;PropertyGrid&lt;/A&gt;&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For example (&lt;FONT color="#FF0000"&gt;fatal source&lt;/FONT&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; Database, BlockTable, BlockTableRecord, Circle and many other!&lt;BR /&gt;Video &lt;A rel="nofollow" target="_self" href="http://www.youtube.com/watch?v=tGLrjMfxEOM"&gt;here&lt;/A&gt; and Code source &lt;A rel="nofollow" target="_self" href="https://docs.google.com/leaf?id=0B7H_2Cq9tBXdODYwNWJiODYtMjE4Ny00YTk2LTg3NGYtYzM3Zjc4MDRkYTZh&amp;amp;hl=ru"&gt;here&lt;/A&gt; (MS VS 2010, AutoCAD 2009 SP3 x86).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Screen for quick understanding:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;IMG src="http://habreffect.ru/files/ecc/010373c1b/05.07.png" height="523" border="0" width="904" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2010 09:26:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2708467#M64924</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-05T09:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Some AutoCAD classes entities as Source for PropertyGrid control = Fatal Err</title>
      <link>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2708761#M64925</link>
      <description>&lt;P&gt;You can't simply assign DBObjects to the PropertyGrid's SelectedObject property,&lt;/P&gt;&lt;P&gt;because it will try to access the object's properties every time it refreshes its&lt;/P&gt;&lt;P&gt;view (e.g, when the control is painted).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do this, you have to implement an object that acts as a wrapper for the&lt;/P&gt;&lt;P&gt;DBObject, and on that object, you have to implement ICustomTypeDescriptor,&lt;/P&gt;&lt;P&gt;and that must return a collection of custom PropertyDescriptor objects that&lt;/P&gt;&lt;P&gt;know how to open the DBObject in order to get each property's value. Then&lt;/P&gt;&lt;P&gt;you assign the wrapper object to the PropertyGrid's SelectedObject property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's how my own tool (shown below) does it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A rel="nofollow" href="http://www.caddzone.com/acadxtabs/CADDPowerToys.htm" target="_blank"&gt;&lt;IMG src="http://www.caddzone.com/acadxtabs/ADE1.png" height="564" border="0" width="682" /&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2010 20:06:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2708761#M64925</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-05T20:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Some AutoCAD classes entities as Source for PropertyGrid control = Fatal Err</title>
      <link>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2708927#M64926</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the answer!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt;You can't simply assign DBObjects to the PropertyGrid's SelectedObject property,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;because it will try to access the object's properties every time it refreshes its&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;view (e.g, when the control is painted).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Than it is dangerous?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But DBObject already is a controlled wrapper for class AcDbObject. Class Autodesk. AutoCAD.DatabaseServices. DBObject it is flagged by attribute [Wrapper ("AcDbObject")].&amp;nbsp;I am right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And all other entities, wich I use in my code as source for PropertyGrid, too is managed wrappers for unmanaged classes already.&lt;/P&gt;&lt;P&gt;Must I write a wrapper over DBObject / Document / Database / e.t.c., wich is wrapper&amp;nbsp;already?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;______________________________________________&lt;/P&gt;&lt;P&gt;P.S. Excuse me for my bad English...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2010 07:14:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2708927#M64926</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-06T07:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Some AutoCAD classes entities as Source for PropertyGrid control = Fatal Err</title>
      <link>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2709977#M64927</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Compositum wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Than it is dangerous?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But DBObject already is a controlled wrapper for class AcDbObject. Class Autodesk. AutoCAD.DatabaseServices. DBObject it is flagged by attribute [Wrapper ("AcDbObject")].&amp;nbsp;I am right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And all other entities, wich I use in my code as source for PropertyGrid, too is managed wrappers for unmanaged classes already.&lt;/P&gt;&lt;P&gt;Must I write a wrapper over DBObject / Document / Database / e.t.c., wich is wrapper&amp;nbsp;already?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;______________________________________________&lt;/P&gt;&lt;P&gt;P.S. Excuse me for my bad English...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, it's dangerous.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yep, DBObject is a 'wrapper' for the native AcDbObject, but that doesn't&lt;/P&gt;&lt;P&gt;change the fact that the DBObject&amp;nbsp;wrapper cannot be used indiscriminately&lt;/P&gt;&lt;P&gt;at any time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A DBObject is only usable while the transaction it was obtained from is active.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While there may be some cases where you can use a DBObject after the&lt;/P&gt;&lt;P&gt;transaction you get it from has ended (for read-only use only)&amp;nbsp;that is entirely&lt;/P&gt;&lt;P&gt;undocumented/unsupported&amp;nbsp;behavior, and doesn't always work, depending&lt;/P&gt;&lt;P&gt;on the type of object, and members being accessed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, you need a 'wrapper' for the DBObject wrapper, and that wrapper must&lt;/P&gt;&lt;P&gt;implement ICustomTypeDescrptor. The GetProperties() methods of that interface&lt;/P&gt;&lt;P&gt;must return a collection of custom PropertyDescriptor objects that know how to&lt;/P&gt;&lt;P&gt;access the properties of a DBObject given its ObjectId.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You only need wrappers for DBObjects because of the special requirements&lt;/P&gt;&lt;P&gt;I noted above. For other types of objects that do not have those constraints.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2010 01:12:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2709977#M64927</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-07T01:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Some AutoCAD classes entities as Source for PropertyGrid control = Fatal Err</title>
      <link>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2710141#M64928</link>
      <description>&lt;P&gt;Many thanks! Now I understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tell me please, how aright&amp;nbsp;implementation&amp;nbsp;&amp;nbsp;ICustomTypeDescriptor for DBObject?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I write it (russian / english comments):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    public class PropDispNameWrapper : ICustomTypeDescriptor
  {
    // Оборачиваемый объект (source object).
    private object _obj;
    // Коллекция, хранящая обертки над описаниями свойств (collection of description properties).
    PropertyDescriptorCollection _propsCollection;

    // Позволяет получить обернутый объект (get wrapped object).
    public object Unwrap{ get{ return _obj; } }

    public PropDispNameWrapper(object obj)
    {
      // Запоминаем оборачиваемый объект (remember source object link).
        _obj = obj;
        
      // Создаем новую (пустую) коллекцию описаний свойств, 
      // в которую поместим обертки над реальными описаниями (Create new (clear) collection of property descriptions and put wrappers for real descriptions).
      _propsCollection = new PropertyDescriptorCollection(null);
      PropertyDescriptorCollection pdc = 
          TypeDescriptor.GetProperties(obj, true);
      // Перебираем описания свойств, создаем для каждого 
      // из них обертку и помещаем ее в коллекцию (description properties iteration. Create wpapper for each, and add in collection).
      foreach(PropertyDescriptor pd in pdc)
        _propsCollection.Add(new MyPropDesc(pd));
    }

    /////////////////////////////////////////////////////////
    /// ICustomTypeDescriptor
    ///
    System.ComponentModel.AttributeCollection ICustomTypeDescriptor.GetAttributes() 
    {
      return new  System.ComponentModel.AttributeCollection(null);
    }

    string ICustomTypeDescriptor.GetClassName() 
    {
      return null;
    }

    string ICustomTypeDescriptor.GetComponentName() 
    {
      return null;
    }

    TypeConverter ICustomTypeDescriptor.GetConverter() 
    {
      return null;
    }

    EventDescriptor ICustomTypeDescriptor.GetDefaultEvent() 
    {
      return null;
    }


    PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() 
    {
      return null;
    }

    object ICustomTypeDescriptor.GetEditor(Type editorBaseType) 
    {
      return null;
    }

    EventDescriptorCollection ICustomTypeDescriptor.GetEvents() 
    {
      return new EventDescriptorCollection(null);
    }

    EventDescriptorCollection ICustomTypeDescriptor.GetEvents
        (Attribute[] attributes) 
    {
      return new EventDescriptorCollection(null);
    }

    PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties() 
    {
      return _propsCollection;
    }

    PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(
        Attribute[] attributes) 
    {
      return _propsCollection;
    }

    object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) 
    {
      return this;
    }
  }

  public class MyPropDesc : PropertyDescriptor
  {

    PropertyDescriptor _PropDesc;

    public MyPropDesc(PropertyDescriptor PropDesc) : base(PropDesc)
    {
      _PropDesc = PropDesc;
    }
    public override string Category{ get{ return _PropDesc.Category; } }
  
    // Это свойство возвращает название свойства, 
    // отображаемое в propertyGrid (It's property, which return displayed property name).
    public override string DisplayName 
    { 
      get 
      {
        // Пытаемся получить атрибут DisplayNameAttribute.
          // В случае неудачи будет возвращен null (try get attribute DisplayNameAttribute. If fail - return null).
        DisplayNameAttribute mna = 
            _PropDesc.Attributes[typeof(DisplayNameAttribute)] as 
            DisplayNameAttribute;
        if(mna != null)
          // Если имеется атрибут DisplayNameAttribute,
            // возвращаем текст, помещенный в него (If DisplayNameAttribute assign, then return text, which in this).
          return mna.ToString();
        // Если атрибут DisplayNameAttribute не задан,
        // возвращаем оригинальное имя свойства (If DisplayNameAttribute not assign, then return original name of property). 
        return _PropDesc.Name;
      }
    }

    public override Type ComponentType 
    {
      get 
      {
        return _PropDesc.ComponentType;
      }
    }

    public override bool IsReadOnly 
    {
      get 
      {
        return false;
      }
    }

    public override Type PropertyType 
    {
      get 
      {
        return _PropDesc.PropertyType;
      }
    }

    public override bool CanResetValue(object component) 
    {
      return _PropDesc.CanResetValue(((PropDispNameWrapper)component).Unwrap);
    }

    public override object GetValue(object component) 
    {
      return _PropDesc.GetValue(((PropDispNameWrapper)component).Unwrap);
    }

    public override void ResetValue(object component) 
    {
      _PropDesc.ResetValue(((PropDispNameWrapper)component).Unwrap);
    }

    public override void SetValue(object component, object value) 
    {
      _PropDesc.SetValue(((PropDispNameWrapper)component).Unwrap, value);
    }

    public override bool ShouldSerializeValue(object component) 
    {
      return _PropDesc.ShouldSerializeValue(
          ((PropDispNameWrapper)component).Unwrap);
    }
  }

  [AttributeUsage(AttributeTargets.Property |
     AttributeTargets.Field)]
  [Serializable]
  public class DisplayNameAttribute : Attribute
  {
    string _sText;
    public DisplayNameAttribute(string Text) : base()
    {
      _sText = Text;
    }
    public override string ToString()
    {
      return _sText;
    }
  }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;but it not correct implementation for DBObject.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2010 09:12:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2710141#M64928</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-07T09:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Some AutoCAD classes entities as Source for PropertyGrid control = Fatal Err</title>
      <link>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2710209#M64929</link>
      <description>&lt;P&gt;Your ICustomTypeDescriptor should store only the ObjectId of the DBObject.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whenever you need to get data from the DBObject, you have to open it in&lt;/P&gt;&lt;P&gt;a transaction, get the data, and commit the transaction and discard the&lt;/P&gt;&lt;P&gt;DBObject. Do not cache the DBObject for subsequent use, because it is&lt;/P&gt;&lt;P&gt;still unusable within the wrapper.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, everywhere in your code where you reference your 'Unwrap'&lt;/P&gt;&lt;P&gt;property, you are using the original DBObject,which you can't do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have to cache&amp;nbsp;it's ObjectId instead, and when you need the&lt;/P&gt;&lt;P&gt;DBObject, you have to use the ObjectId to open the DBObject in&lt;/P&gt;&lt;P&gt;a transaction, use the DBObject,and then discard it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's the first problem. The other problem is that you must ensure that&lt;/P&gt;&lt;P&gt;any property that returns a DBObject, is wrapped in your custom wrapper,&lt;/P&gt;&lt;P&gt;rather than allowing the DBObject itself to be exposed as the value of&lt;/P&gt;&lt;P&gt;the property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What you're attempting to do is not simple or trivial. Trust me. It tiook me&lt;/P&gt;&lt;P&gt;about a year to get own implmentation fully working and debugged.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2010 11:32:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2710209#M64929</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-07T11:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Some AutoCAD classes entities as Source for PropertyGrid control = Fatal Err</title>
      <link>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2710263#M64930</link>
      <description>&lt;P&gt;Many thanks!&lt;/P&gt;&lt;P&gt;I will try to do how you have advised to me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--------------------------------------&lt;/P&gt;&lt;P&gt;Sorry for my bad English.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2010 12:07:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/some-autocad-classes-entities-as-source-for-propertygrid-control/m-p/2710263#M64930</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-07T12:07:06Z</dc:date>
    </item>
  </channel>
</rss>

