IsolationLevel.Unspecified

Posts   
 
    
ciroque
User
Posts: 5
Joined: 02-Jan-2013
# Posted on: 17-Jan-2013 00:21:15   

I need for LLBLGen to not supply an ISOLATION LEVEL in the connection parameters. I want the Transaction Isolation Level default for the database to be used. Can I accomplish this by providing the IsolationLevel.Unspecified value to the Transaction ctor?

Thanks!

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Jan-2013 06:33:10   

Yes, the IsolationLevel.Unspecified is supported. You can use the value that suits you the most from System.Data.IsolationLevel:

// adapter
adapter.StarTransaction(IsolationLevel.Unspecified, "Test");

// selfServicing
Transaction transactionManager = new Transaction(IsolationLevel.Unspecified, "Test");
David Elizondo | LLBLGen Support Team
ciroque
User
Posts: 5
Joined: 02-Jan-2013
# Posted on: 29-Jan-2013 20:29:05   

daelmo wrote:

Yes, the IsolationLevel.Unspecified is supported. You can use the value that suits you the most from System.Data.IsolationLevel:

// adapter
adapter.StarTransaction(IsolationLevel.Unspecified, "Test");

// selfServicing
Transaction transactionManager = new Transaction(IsolationLevel.Unspecified, "Test");

Is there a project-level setting I can change that will ensure all generated code uses IsolationLevel.Unspecified?

Thanks!

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Jan-2013 06:12:33   

ciroque wrote:

Is there a project-level setting I can change that will ensure all generated code uses IsolationLevel.Unspecified?

No, no through settings. Besides the IsolationLevel is mandatory in the adapter.StartTransaction method. What you can do is create your own StarTransaction method in a DataAccessAdapter partial class or in the DataAccessAdapter.cs USER_CODE_REGION:

// __LLBLGENPRO_USER_CODE_REGION_START CustomDataAccessAdapterCode
public virtual void StartTransaction(string name)
{
    StartTransaction(System.Data.IsolationLevel.Unspecified, name);
}
// __LLBLGENPRO_USER_CODE_REGION_END

... then use that method in your code:

using (var adapter = new DataAccessAdapter())
{
    adapter.StartTransaction("Test..");
    ...
}
David Elizondo | LLBLGen Support Team