Note that there are some explanatory texts on larger screens.

plurals
  1. POMono.Data.Sqlite.SqliteConnection requiring a version of 'System' that doesn't make sense
    text
    copied!<h2>We're having issues with our Sqlite PCL Project.</h2> The issues <p>1) Anywhere that references <code>Mono.Data.Sqlite.SqliteConnection</code> shows the following error. </p> <blockquote> <p>Module 'System, Version 4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' should be referenced.</p> </blockquote> <p>2) Anything trying to use <code>File.Exists</code> is showing a compiler error </p> <blockquote> <p>Cannot resolve symbol 'File'</p> </blockquote> The particulars <p>We're using .NET Portable Subset 158 </p> <ul> <li><code>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile158\</code></li> </ul> <p>We've included</p> <ul> <li>Mono.Data.Sqlite <ul> <li><code>C:\Program Files (x86)\Mono-3.2.3\lib\mono\4.5\Mono.Data.Sqlite.dll</code></li> </ul></li> <li>System.Data <ul> <li><code>C:\Program Files (x86)\Mono-3.2.3\lib\mono\4.5\System.Data.dll</code></li> </ul></li> </ul> <p>I have no idea where to go from here.</p> <p>Here's a class file containing the issues with <code>SqliteConnection</code></p> <pre><code>using System; using Mono.Data.Sqlite; namespace OurApplication.AppCore.Data.Sqlite { public class DbConnectionProvider : IDbConnectionProvider { private readonly string _connectionString; public DbConnectionProvider(string sqliteDatabasePath, string databaseName) { // the sqliteDatabasePath is hard coded in 'Data.Sqlite.DbProvider' // _sqliteDatabasePath = "{0}.sqlite3"; _connectionString = string.Format("Data Source=" + sqliteDatabasePath, databaseName); } public SqliteConnection GetOpenConnection() { var connection = new SqliteConnection(_connectionString); if (connection == null) throw new Exception("Could not create a database connection."); connection.Open(); return connection; } } } </code></pre> <p><a href="https://gist.github.com/ChaseFlorell/7531769" rel="nofollow noreferrer">Gist with more code examples</a></p> <p>If this approach isn't feasible, I'm open to other alternatives. I'm looking into Sqlite.Net but the API doesn't really do what I want with regards to a custom DbReader and such. </p> <p>I'm also interested in <a href="https://stackoverflow.com/users/373321/stuart">Stuart Lodge</a>'s <a href="https://github.com/MvvmCross/MvvmCross-SQLite" rel="nofollow noreferrer">MvvmCross Sqlite</a> stuff, but really have no idea how to integrate the platform specific goodness. Honestly, I can't even figure out how to Execute Parameterized Queries.</p> <p>I think my preference would be to use MvvmCross-SQLite if I can just get it figured out.</p> <p>For references, this is how our Solution is structured.</p> <ul> <li>OurApplication.App.Droid</li> <li>OurApplication.AppCore</li> <li>OurApplication.AppCore.Data.Sqlite (<em>This is the project I'm working in.</em>)</li> <li>OurApplication.AppCore.Data.SqlServer</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload