Description
This is really a cross-post of the issue in the parent repository. But frankly, I think this fork is better organized, and cleaner in many aspects.
In the wake of creating a better API, I feel the issue's relevance is more here, than the parent.
Cross-posted Issue: praeclarum#352
"The SQLiteAsyncConnection currently, executes the Func each time its performs a query. Now, this in most scenarios could be ideal, but the problem is how it manages its connection.
The only reason for the design decision to executes the Func that I can think of, instead of a connection directly is so that that this could possibly create a new connection. When we're providing a direct connection, it might as well be done without a Func. It just becomes an unnecessary indirection.
But what's alarming is that if you indeed provide a Func that creates a new connection, now a new problem is created. The connection lifetime management becomes tedious. Since the there's no way to close the connection without holding on to the connection itself externally. And if it does create a new connection, the lock becomes redundant.
Now, the only way to really make use of the Async properly is to pass in the same connection through the func, while both the connection, and the async wrapper being managed explicitly. This opens up more responsibilities for the class than it ought to be dealing with it.
I feel the entire of Async functionality here is misleading and creates more problems (or at-the-least encourages anti-patterns) than it really solves. Perhaps, pull it out of the stable packages for now?
PS: I also feel the ConnectionPool is misleading. Its not really a pool. It just look up a dictionary and manages a single connection for each string. Its no pool of connections."