2

On this page https://bitbucket.org/twincoders/sqlite-net-extensions I found how to use SQLite-Net Extensions. But in order to start using it, there is a call:

var db = Utils.CreateConnection();

How to implement this method?

Uros
  • 2,099
  • 7
  • 23
  • 50

3 Answers3

2

From the SQLite NET docs

var db = new SQLiteConnection(sqlitePlatform, myDBFilePath);
Jason
  • 86,222
  • 15
  • 131
  • 146
1

I too would love to know how to implement Utils.CreateConnection()

Ah c'mon guys give us a clue

the current answer posted (with some apparent condescension quoting 'from SQlite net docs' as if to say its simple...idiot!) helps not one little bit if one is using SQLite-net in xamarin forms

the statement "var xxx= new SQLiteConnection(dbp);" takes only the path of the DB and does not call for a 'platform' parameter when using the above assembly

To what namespace does Utils.CreateConnection() belong - what assemblies need to be included if using Frank Kruegers SQLite-net.pcl in Xamarin forms questions ?? 1) Does the sqlite-net-extensions work with sqlite-net-pcl in Xam forms ? 2) why does there need to be such a proliferation of SQLite assemblies some with uppercase some with dashes 3) why is SQL and c# such a tower of Babel

Dya know it would be really useful if on such fora as these or in so called helpful 'code snippets' the Assemblies used were included - even if it is simply including the 'using' statements. Sorry for the grumpy post but surely its a fair question

0

Quite an old thread but the answer can be found from the author repo:

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
        }
apicoding
  • 13
  • 3