Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeginTransaction can only be called when the connection is open error in SqLite provider #319

Open
springjazzy opened this issue Jul 29, 2021 · 2 comments

Comments

@springjazzy
Copy link

springjazzy commented Jul 29, 2021

I keep getting BeginTransaction can only be called when the connection is open error while using SqLite provider,

How does it supposed to work? What am I doing wrong?

var threadId = Thread.CurrentThread.ManagedThreadId;

Here we create "connection pool" per ManagedThreadId. All connection by default are closed.

Here is the only place I found where connection is explicitly opened:

In, asp.net core environment I frequently encounter thread switching which cause SQLiteDatabaseProvider not to use opened connection but to create new connection (closed). Later when BeginTransaction is called

var tran = _cache.BeginTransaction();

I get BeginTransaction can only be called when the connection is open exception.

@catcherwong
Copy link
Member

@springjazzy Thanks for your interest in this project.

We will take a look ASAP.

This SQLite issue is related with #260 .

BTW, which version are you using?

@springjazzy
Copy link
Author

Thanks for reply.
I'm using 1.3.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants