Transactions with Adapter and SQL Profiler

Posts   
 
    
aspicer
User
Posts: 65
Joined: 14-Nov-2008
# Posted on: 15-Sep-2010 17:27:33   

**LLBLGen Pro version + buildnr: **v3.0 Final (Sept 8, 2010) Post the template group + .NET version you're using: Adapter with .NET 4.0 Post the database type and version you're using: SQL Server 2008 R2

Previously I worked with v2.6 with the self servicing templates. I am now switching to v3 with the Adapter templates. Since the adapter model is totally different than the selfservicing model that I was accustom to, I have been testing some code recently utilizing the SQL Profile to ensure that the transactions were working as I expected. The problem is that I can't seem to capture the transaction statements in the SQL Server Profiler.

Below is a snippet from a sample unit test:


using (DataAccessAdapter adapter = new DataAccessAdapter())
{
    adapter.StartTransaction(System.Data.IsolationLevel.ReadUncommitted, "test1");

    var learner = (from l in new LinqMetaData(adapter).Learner
                select l).First();
    learner.LastName = "NewLastName";
    adapter.SaveEntity(learner);

    adapter.Rollback();
}

The profiler ONLY captured the SELECT and the UPDATE. I expected to see the Set Isolation level, Begin transaction and the _Rollback _statements. The data did not get committed (as expected because of the rollback) but I can't seem to figure out WHY I can't see the transaction statements in the profiler.

I use the same profiler on a SQL SERVER 2000 database that has SelfServicing v2.6 code running and I see the transaction statements under the SQL:BatchCompleted event:

SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;BEGIN TRANSACTION
go
...dowork...
COMMIT TRANSACTION
go

Has anyone else encountered this issue? Does the Adapter model in v3 manage transactions at a database level differently than SelfServicing did in v2.6?


As a side note, while writing this message I downloaded the latest LLBLGen version to first see if whatever my issue is above has been corrected. In doing so I think I encountered a bug regarding the .typeimports feature. Before installing the latest build for v3 I had a .typeimports file that described enumeration types that I was using the in my entities. This worked great (_I love not having to write my own typeconverters - awesome_). After updating to the new version I get warnings when I open the project that say that the "Type shortcut for "DockType" has been reverted to System.String because its original type "... my awesome type here ..." wasn't found among the loadable TypeConverters nor the imported enum types..." I didn't change anything else, just updated LLBLGen to the latest build. I double checked the project settings and it still has my path defined to the **AdditionalTypeConverterFolder** and my** .typeimports** file hasn't changed. Can you _also _help me with this problem? -- Scratch that... I remember I had to modify the .config file for .NET 4 support. wink

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 16-Sep-2010 08:26:59   

Must be a setting missing in the SQL Profiler Trace.

To be sure of what commands LLBLGen issue, you can use Dynamic Query Engine tracing

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39894
Joined: 17-Aug-2003
# Posted on: 16-Sep-2010 10:42:21   

In the most recent build, we introduced a .net 4.0 runner, so you can just run that one instead of modifying config files wink (see start menu )

Frans Bouma | Lead developer LLBLGen Pro
aspicer
User
Posts: 65
Joined: 14-Nov-2008
# Posted on: 16-Sep-2010 16:16:43   

Walaa wrote:

Must be a setting missing in the SQL Profiler Trace.

To be sure of what commands LLBLGen issue, you can use Dynamic Query Engine tracing

I figure it must be some setting that I am missing in the profiler but I haven't had any luck finding the right setting. I've enabled the DQE tracing and it shows me the transaction info but it fails to show the sql statement sent to the server to start the transaction. Previously in SQL Server 2000 I was able to use the profiler and watch the transaction statements come in through the SQL:BatchCompleted event. For some reason I can't see that data coming through now on SQL Server 2008.

I found a related StackOverflow discussion here: http://stackoverflow.com/questions/3630544/linq-and-transcationscope-not-working I have the same issue with the Profiler only showing the initial connection's IsolationLevel through the AuditLogin event. The SQL:BatchCompleted event doesn't seem to show the transaction statements sent to the server.

I realize that you don't troubleshoot SQL Profiler but I was accustom to using it against SQL Server 2000 and SelfServicing in V2.6 for troubleshooting purposes and it was made easier by the fact that the transaction event details were present in the trace. Since changing to v3, SQL Server 2008 and Adapter I thought I'd ask the question here to see if there was some sort of change in the way that the transaction statements were sent to SQL Server either in v3 or in the Adapter. Do you have any advice or past experience with this issue?

aspicer
User
Posts: 65
Joined: 14-Nov-2008
# Posted on: 16-Sep-2010 16:17:19   

Otis wrote:

In the most recent build, we introduced a .net 4.0 runner, so you can just run that one instead of modifying config files wink (see start menu )

Thanks Otis!

aspicer
User
Posts: 65
Joined: 14-Nov-2008
# Posted on: 17-Sep-2010 16:27:04   

aspicer wrote:

Walaa wrote:

Must be a setting missing in the SQL Profiler Trace.

To be sure of what commands LLBLGen issue, you can use Dynamic Query Engine tracing

I figure it must be some setting that I am missing in the profiler but I haven't had any luck finding the right setting. I've enabled the DQE tracing and it shows me the transaction info but it fails to show the sql statement sent to the server to start the transaction. Previously in SQL Server 2000 I was able to use the profiler and watch the transaction statements come in through the SQL:BatchCompleted event. For some reason I can't see that data coming through now on SQL Server 2008.

I found a related StackOverflow discussion here: http://stackoverflow.com/questions/3630544/linq-and-transcationscope-not-working I have the same issue with the Profiler only showing the initial connection's IsolationLevel through the AuditLogin event. The SQL:BatchCompleted event doesn't seem to show the transaction statements sent to the server.

I realize that you don't troubleshoot SQL Profiler but I was accustom to using it against SQL Server 2000 and SelfServicing in V2.6 for troubleshooting purposes and it was made easier by the fact that the transaction event details were present in the trace. Since changing to v3, SQL Server 2008 and Adapter I thought I'd ask the question here to see if there was some sort of change in the way that the transaction statements were sent to SQL Server either in v3 or in the Adapter. Do you have any advice or past experience with this issue?

I see this post was marked as 'done' - maybe because of the post made after the one quoted above? I was hoping to get a reply about my comments related to the above message. If not, thats ok... I was trying to find out if anyone has encountered the same issue. Thanks for your help.