- 增加 FreeSql.Provider.Sqlite 对 Xamarin 环境下的适配;

This commit is contained in:
28810
2019-11-07 02:33:27 +08:00
parent 13810c4422
commit 8ec8daa6be
5 changed files with 215 additions and 9 deletions

View File

@ -3,7 +3,6 @@ using SafeObjectPool;
using System;
using System.Collections;
using System.Data.Common;
using System.Data.SQLite;
using System.Text;
using System.Threading;
@ -56,7 +55,7 @@ namespace FreeSql.Sqlite
protected override DbCommand CreateCommand()
{
return new SQLiteCommand();
return MonoAdapter.GetSqliteCommand();
}
protected override void ReturnConnection(ObjectPool<DbConnection> pool, Object<DbConnection> conn, Exception ex)

View File

@ -4,7 +4,6 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@ -35,7 +34,7 @@ namespace FreeSql.Sqlite
public void Return(Object<DbConnection> obj, Exception exception, bool isRecreate = false)
{
if (exception != null && exception is SQLiteException)
if (exception != null && MonoAdapter.IsSqliteException(exception))
{
try { if (obj.Value.Ping() == false) obj.Value.OpenAndAttach(policy.Attaches); } catch { base.SetUnavailable(exception); }
}
@ -112,7 +111,7 @@ namespace FreeSql.Sqlite
public DbConnection OnCreate()
{
var conn = new SQLiteConnection(_connectionString);
var conn = MonoAdapter.GetSqliteConnection(_connectionString);
return conn;
}