.NET

Reply
Distinguished Contributor
Dale.Bartlett
Posts: 151
Registered: ‎01-06-2003
Message 1 of 2 (281 Views)
Accepted Solution

doc.TransactionManager or db.TransactionManager

281 Views, 1 Replies
01-28-2013 11:56 PM

Dumb question: What is the difference? When to use one or the other? I've made the usual investigation and found these very good articles:

http://spiderinnet1.typepad.com/blog/2012/04/database-transactionmanager-and-document-transactionman...

http://spiderinnet1.typepad.com/blog/2012/05/document-transactionmanager-is-nowhere-for-external-dat... 

Can anyone add some additional insight? It appears that db.TransactionManager will serve in all situations. Thanks, Dale

Loooking at it quickly in reflector it inherits from TransactionManager and looks like it just adds the functionality to flush graphics

 

[Wrapper("AcTransactionManager")]
public sealed class TransactionManager : TransactionManager
{
// Methods
internal TransactionManager(IntPtr unmanagedObject, [MarshalAs(UnmanagedType.U1)] bool bAutoDelete);
protected sealed override void DeleteUnmanagedObject();
public void EnableGraphicsFlush([MarshalAs(UnmanagedType.U1)] bool doEnable);
public void FlushGraphics();
internal unsafe AcTransactionManager* GetImpObj();
public sealed override Transaction StartTransaction();
// Properties
public override Transaction TopTransaction { get; }
}

 

 It uses a AppTransaction that inherits from Transaction looks it just overrides Commit() and uses base functionality then flushes the graphics.

 

internal sealed class AppTransaction : Transaction
{
// Fields
private TransactionManager m_mgr;
// Methods
protected internal AppTransaction(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete, TransactionManager mgr) : base(unmanagedPointer, autoDelete)
{
this.m_mgr = mgr;
}
public sealed override void Commit()
{
base.Commit();
((TransactionManager) this.TransactionManager).FlushGraphics();
}
// Properties
public override TransactionManager TransactionManager
{
get
{
return this.m_mgr;
}
}
}

 

So looks like if want to call FlushGraphics for each commit then use the Document TransactionManager.

 

Now that I say that seems like I just saw Tony mention to use the Documents Transmamnger when it came to regenerating graphics or something similar. 

 

Valued Mentor
jeff
Posts: 335
Registered: ‎05-12-2009
Message 2 of 2 (270 Views)

Re: doc.TransactionManager or db.TransactionManager

01-29-2013 01:41 AM in reply to: Dale.Bartlett

Loooking at it quickly in reflector it inherits from TransactionManager and looks like it just adds the functionality to flush graphics

 

[Wrapper("AcTransactionManager")]
public sealed class TransactionManager : TransactionManager
{
    // Methods
    internal TransactionManager(IntPtr unmanagedObject, [MarshalAs(UnmanagedType.U1)] bool bAutoDelete);
    protected sealed override void DeleteUnmanagedObject();
    public void EnableGraphicsFlush([MarshalAs(UnmanagedType.U1)] bool doEnable);
    public void FlushGraphics();
    internal unsafe AcTransactionManager* GetImpObj();
    public sealed override Transaction StartTransaction();

    // Properties
    public override Transaction TopTransaction { get; }
}

 

 

 It uses a AppTransaction that inherits from Transaction looks it just overrides Commit() and uses base functionality then flushes the graphics.

 

internal sealed class AppTransaction : Transaction
{
    // Fields
    private TransactionManager m_mgr;

    // Methods
    protected internal AppTransaction(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete, TransactionManager mgr) : base(unmanagedPointer, autoDelete)
    {
        this.m_mgr = mgr;
    }

    public sealed override void Commit()
    {
        base.Commit();
        ((TransactionManager) this.TransactionManager).FlushGraphics();
    }

    // Properties
    public override TransactionManager TransactionManager
    {
        get
        {
            return this.m_mgr;
        }
    }
}

 

 

So looks like if want to call FlushGraphics for each commit then use the Document TransactionManager.

 

Now that I say that seems like I just saw Tony mention to use the Documents Transmamnger when it came to regenerating graphics or something similar. 

 

You can also find your answers @ TheSwamp
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!