Thanks for your answer.
Suppose I have this :
try { db.LoadLineTypeFile(clType, cLinFile); }
catch { }
Can I unlock the document in the catch since there is nothing ?
And one last question if I may. If I want to replace this :
DocumentLock loc = doc.LockDocument();
using (Transaction tr = db.TransactionManager.StartTransaction())
{
DBObjectCollection objs = new DBObjectCollection();
BlockReference br = tr.GetObject(blkId, OpenMode.ForWrite) as BlockReference;
.....
with "using document lock"
should I declare using (doc.LockDocument()) inside or outside using (Transaction tr = db.TransactionManager.StartTransaction()) ?
using (doc.LockDocument())
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
DBObjectCollection objs = new DBObjectCollection();
BlockReference br = tr.GetObject(blkId, OpenMode.ForWrite) as BlockReference;
....
}
}
or
using (Transaction tr = db.TransactionManager.StartTransaction())
{
using (doc.LockDocument())
{
DBObjectCollection objs = new DBObjectCollection();
BlockReference br = tr.GetObject(blkId, OpenMode.ForWrite) as BlockReference;
....
}
}