Enterprise Service

Posts   
 
    
Posts: 4
Joined: 13-Jul-2005
# Posted on: 13-Jul-2005 11:44:54   

I am working on a project right now that the BL will access multiple databases in a single transaction. I will have to maintain all the states of the transaction and rollback when required. Right now, my BL is an .NET Enterprise Component that using DAL (multiple) generated from LLBLGenPro to access the databases. It's not done yet (Please comment if you think this is not a good idea).

What I want to ask is : - Can I migrate the DAL (generated by LLBLGen) into .NET Enterprise Service? - If yes, how? - Can I change the template so that I can insert required codes for the conversion to .NET Enterprise Service, then I generate the code?

Thanks in advance.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 13-Jul-2005 12:20:18   

COM+ transactions or enterprise services transactions are fully supported. So if you're using adapter now, please check out the COM+ transactions section in the adapter documentation (in using the generated code -> adapter -> transactions)

You create one ComPlusAdapterContext instance which controls your multi-db transaction. It has already an adapter assigned to it, for the particular db.

You can use this ComPlusAdapterContext with adapters of other databases, by using this: (for example, the myComPlusAdapterContext is created from the Oracle db specific project and you now want to use it with sqlserver as well in a multi-db transaction. You create a small factory which accepts a name string for the type of adapter to create and optionally a ComPlusAdapterContextBase)


IDataAccessAdapter sqlserverAdapter = MyAdapterFactory.Create("SqlServer", myComPlusAdapterContext);
// which effectively does:
return new DataAccessAdapter(myComPlusAdapterContext);

And then from then on, the sqlserverAdapter uses a COM+ transaction, controlled by myComPlusAdapterContext, so commiting a transaction on the adapter won't commit the transaction unless you commit it on the ComPlusAdapterContext object.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 4
Joined: 13-Jul-2005
# Posted on: 13-Jul-2005 13:02:05   

Frans, Thanks for your quick response. Could you tell where I can find this documentation? I am looking at the documentation included with LLBLGen Pro package, and I couldn't find it.

THanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 13-Jul-2005 13:32:30   

Using the generated code -> adapter -> Transactions. In there is a section and example of COM+ transaction usage.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 4
Joined: 13-Jul-2005
# Posted on: 13-Jul-2005 13:46:03   

Otis wrote:

Using the generated code -> adapter -> Transactions. In there is a section and example of COM+ transaction usage.

Thanks. Just want to point out. I dont have this section listed in the tree. However, when I search it, I found a page.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 13-Jul-2005 14:39:50   

Erm, I do, right below 'Prefetch paths'. You use an older version ?

Frans Bouma | Lead developer LLBLGen Pro
Posts: 4
Joined: 13-Jul-2005
# Posted on: 19-Jul-2005 05:22:01   

Otis wrote:

Erm, I do, right below 'Prefetch paths'. You use an older version ?

Designer version: 1.0.2004.2 Runtime libraries version: 1.0.2004.2

This is my version.

By the way, I read through the article. It helps a lot. THanks. I just have a quick question, does the "DBSpecific" have to be put in the MTS? or just my COM+ components reference it as dll enough? thanks

Jimmy

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 19-Jul-2005 09:52:50   

chillspider wrote:

Otis wrote:

Erm, I do, right below 'Prefetch paths'. You use an older version ?

Designer version: 1.0.2004.2 Runtime libraries version: 1.0.2004.2

This is my version.

By the way, I read through the article. It helps a lot. THanks. I just have a quick question, does the "DBSpecific" have to be put in the MTS? or just my COM+ components reference it as dll enough?

Your own code has to be added to a COM+ package or let .NET do that for you. MTS is NT4 and I'm not sure if that's supported.

Frans Bouma | Lead developer LLBLGen Pro