Print Page | Close Window

Pervasive PSQL Provider and Enlist Transaction

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2428
Printed Date: 29-Jul-2026 at 1:07pm


Topic: Pervasive PSQL Provider and Enlist Transaction
Posted By: thecotton
Subject: Pervasive PSQL Provider and Enlist Transaction
Date Posted: 08-Jan-2011 at 9:38pm
The Pervasive PSQL .Net provider 3.5 is compatible with EF2 and Framework 4 EXCEPT that it does not currently support distributed transactions - only local transactions. It works fine with the VS 2010 entity data model (ie, without Devforce EF), but I have had zero success getting it to work with Devforce. If I set the connection to enlist transactions, I get an exception of "The underlying provider failed on open" with inner exception "Specified method is not supported" as was expected from Pervasive documentation. When I set the connection NOT to enlist transactions, I get exception from Ideablade.EntityModel  "The underlying provider failed on Enlist Transaction". I have tried setting TransactionSettings to change UseTransactionScope to false, but I srill get the same error. Checking the Pervasive trace log, it would appear that the Pervasive provider did not throw the error - it just shows to have opened the connection and then closed it when I stop the debugger.
 
What can I do to allow use of the PSQL provider without enlisting transactions? Again, when used with the entity framework modeler alone, it works OK.
 



Replies:
Posted By: sbelini
Date Posted: 13-Jan-2011 at 5:42pm
Hi thecotton,
 
Where are you setting UseTransactionScope?
(I'm assuming you are using
TransactionSettings.Default = new TransactionSettings (System.Transactions.IsolationLevel.ReadCommitted, new TimeSpan(0, 1, 0), false);
if not let me know how you are setting it)
 
Also, could you verify that UseTransactionScope is set to false right before the save/query throwing the exception?
(i.e.
var queryTransactional = mgr.DefaultQueryStrategy.TransactionSettings.UseTransactionScope;
var saveTransactional = mgr.DefaultSaveOptions.TransactionSettings.UseTransactionScope;
)
 
Silvio.


Posted By: thecotton
Date Posted: 14-Jan-2011 at 6:02pm
I am setting as follows:
Imports IbEm = IdeaBlade.EntityModel
Imports IbCore = IdeaBlade.Core
Imports DevForceTest.TrackerEntities
Public Class TrafficForm
Dim qts As New IbEm.TransactionSettings(Transactions.IsolationLevel.ReadCommitted, New TimeSpan(0, 0, 15), False)
Dim ts As New IbEm.TransactionSettings(Transactions.IsolationLevel.ReadCommitted, New TimeSpan(0, 0, 15), False)
Dim WithEvents Tracker As New DevForceTest.TrackerEntities
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TrackerEntities.DefaultManager.DefaultQueryStrategy = TrackerEntities.DefaultManager.DefaultQueryStrategy.With(qts) ‘ adding this line fixed problem
TrackerEntities.DefaultManager.DefaultSaveOptions.TransactionSettings = ts
TrackerEntities.DefaultManager.Connect()
Try
Me.TrafficBindingSource.DataSource = _
Tracker.Traffics.OrderBy(Of Integer)(Function(Traffic) Traffic.TrafKey).ToList()
Catch ex As Exception
Debug.Print(ex.Message)
End Try
End Sub

Private Sub Tracker_Saving(ByVal sender As Object, ByVal e As IdeaBlade.EntityModel.EntitySavingEventArgs) Handles Tracker.Saving
Debug.Print("Saving")
End Sub
End Class
I discovered that I was setting DefaultSaveOptions.TransactionSettings, but had failed to set TransactionSettings for DefaultQueryStrategy. Now that I am setting both, the connection error has gone away. I also picked up your much-more-understandable TransactionSettings.Default, which would have done away with much of my code.

Now if I can only figure out why it is not saving changes, I may get this worked out....


Posted By: sbelini
Date Posted: 18-Jan-2011 at 10:35am
Hi thecotton,
 
I'm glad you solved the first issue.
What problem are you having while trying to save changes?


Posted By: thecotton
Date Posted: 21-Jan-2011 at 9:26pm

I needed to make a PSQL connection to the database before the save (and that's also where I needed to do the PSQL BeginTransaction, but that wouldn't have prevented saving changes). No hill for a climber. I'm just now beginning to get a feel for what needs to be done. I have just been making things too complicated....




Print Page | Close Window