public static string GetCode(this ObjectId entityId) { using (var trans = entityId.Database.TransactionManager.StartTransaction()) { var entity = (Entity)trans.GetObject(entityId, OpenMode.ForRead); return(DbHelper.GetCode(entity)); } }