.Net Help? With custom objects.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
OK, I have an arx .net project, a dbx project, and a dbx.net wrapper project. This is all working fine except the way I have to open my custom objects in the same manner that I can open native objects. Basically, if I wanted to open a line (native) object, I can get the .net wrapped object from the object id.
[code]
using (Transaction tr = curDb.TransactionManager.StartTransaction())
{
Line line = tr.OpenObject(lineId, OpenMode.ForRead) as Line;
... Do something with line here.
}
[/code]
For my custom object, I have to open the custom as an RXObject first then create the .net object passing in the unmanaged object as a parameter.
[code]
using (Transaction tr = curDb.TransactionManager.StartTransaction())
{
RXObject rxObj = tr.OpenObject(lineId, OpenMode.ForRead) as RXObject;
if(rxObj != null)
{
CustObjNet custObj = new CustObjNet(rxObj.UnamanagedObject, true);
.... Do something with custObj
}
... Do something with line here.
}
[/code]
Is the above code correct for custom objects? Is there something that can be done in the .net Wrapper to make it behave like the native entity wrappers?
Any advice would be appreciated.
Mike B