Why is LLBLGen code-generating its Transaction class?

Posts   
 
    
cgerecke
User
Posts: 10
Joined: 07-Oct-2008
# Posted on: 27-Apr-2009 23:57:50   

Hi,

I am wondering as to why LLBLGen is code-gen its Transaction class. Why is it not using the Transaction class in System.Transactions? Even, if LLBLGen needs its own Transaction class because of the fact that it needs to support to different DBs, why does it need to be code-gen-ed for every project?

Why do I ask? Well, we are building our internal library for custom purposes that needs to be able to pass transactions around. This internal library will be used in many of our projects. In this case, I cannot use the Transaction class that is code-gen-ed for just one project. Ideally, I would like to support the class in the System.Transactions namespace since this will allow us to use the same transaction for both LLBLGen classes and also for straight ADO.NET.

I would appreciate it if someone could explain the reasons for auto-generating the Transaction class in LLBLGen...

Thank You, Vish

rdhatch
User
Posts: 198
Joined: 03-Nov-2007
# Posted on: 28-Apr-2009 04:34:09   

I have never needed to customize my Transaction object, so I'm not sure exactly why they are being generated. However, I'm sure Frans has a scenario when this would be needed.

I also have developed an internal library here that is shared between our projects. We use TransactionBase whenever we can.

When we need to - I use Reflection to create new Transaction objects from the generated Data Objects assembly. If you'd like, I can share with you how we do this.

Hope this helps!

Ryan

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 28-Apr-2009 09:27:15   

The code predates System.Transactions so it was already there (and removing it would break all applications) and secondly, Transaction in System.Transactions isn't the same kind of class. The generated Transaction class does more for the internal framework like tracking which entities are in the transaction etc.

Frans Bouma | Lead developer LLBLGen Pro
cgerecke
User
Posts: 10
Joined: 07-Oct-2008
# Posted on: 28-Apr-2009 15:43:41   

Hi,

I think I might have to resort to some options like the one rdhatch had mentioned to solve this one. But the problem still remains that I cannot use the same transaction for LLBLGen and for ADO.NET... Does LLBLGen even have this change to use System.Transactions on their radar? Can the LLBLGen transaction's additional functionality be provided by inherting from the System.Transactions? Or can LLBLGen's Transaction add a method called GetSystemTransaction(...) or take a System.Transaction in its constructor so that the code that I write with LLBLGen plays nice with other ORMs & ADO.NET.

.NET 2.0 has been out for ages now... so maybe it is time to support System.Transactions ???

Thank You, Vish

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 28-Apr-2009 16:10:06   

There is support for system.transactions. simple_smile

It requires sqlserver 2005+ or oracle 11 of course.

It still requires a Transaction object, as that's how TransactionScope's work: they delegate the control of what's in the transaction to another object, which is our own transaction (as it already does that).

I'm not quite sure if I understand you correctly in what you're planning to do. If you think you can simply use System.Transactions you're mistaken, it's not going to work: something has to track what's IN the transaction, as System.Transaction's code simply controls the communication with MSDTC + DB, it doesn't control the actual creation of ADO.NET transactions which you still need. That's where our own transaction comes in as it represents an ADO.NET transaction.

Frans Bouma | Lead developer LLBLGen Pro