Skip to content

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

Open
@springjazzy

Description

@springjazzy

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions