如何创建连接?

How to create connection?

在这个页面上https://bitbucket.org/twincoders/sqlite-net-extensions 我找到了如何使用 SQLite-Net Extensions。但是为了开始使用它,有一个调用:

var db = Utils.CreateConnection();

如何实现这个方法?

来自 SQLite NET 文档

var db = new SQLiteConnection(sqlitePlatform, myDBFilePath);

我也很想知道如何实现 Utils.CreateConnection()

啊来吧,伙计们给我们一个线索

当前的答案 posted(带有明显的屈尊引用 'from SQlite net docs' 好像在说它简单...白痴!)如果一个人正在使用 SQLxamarin 形式的 ite-net

声明"var xxx= new SQLiteConnection(dbp);" 仅采用数据库的路径,并且在使用上述程序集时不调用 'platform' 参数

Utils.CreateConnection() 属于什么命名空间 - 如果在 Xamarin 表单中使用 Frank Kruegers SQLite-net.pcl,需要包含哪些程序集 问题 ?? 1) sqlite-net-extensions 是否与 Xam 表单中的 sqlite-net-pcl 一起使用? 2) 为什么需要如此大量的 SQLite 程序集,有些是大写的,有些是破折号的 3)为什么SQL和c#是个通天塔

Dya 知道,如果在这些论坛或所谓的有用 'code snippets' 中包含使用的程序集,那将非常有用 - 即使它只是包含 'using' 语句。 对脾气暴躁的 post 表示抱歉,但这肯定是一个公平的问题

很老的话题了,但是可以从作者的回购中找到答案:

https://bitbucket.org/twincoders/sqlite-net-extensions/src/master/Tests/IntegrationTests/Utils.cs

public static SQLiteConnection CreateConnection()
        {
#if USING_MVVMCROSS
            return new TouchSqliteConnectionFactory().GetConnection(DatabaseFilePath);
#else
            var con = new SQLiteConnection(DatabaseFilePath);
            raw.sqlite3_trace(con.Handle, Log, null);
            return con;
#endif
        }