title: Cannot run SQLite.net PCL in ASP.NET MVC
body: <p>I am getting my feet wet with Frank A. Krueger's <a href="https://github.com/praeclarum/sqlite-net" rel="nofollow noreferrer">SQLite.net PCL</a>.  I am attempting to use it as the common data layer for an Android app as well as an ASP.NET MVC web application.  I have had some success with Android use, but in trying to use it for the web app I get the following exception:</p>
  
  <p><code>You need to call SQLitePCL.raw.SetProvider().  If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init().</code></p>
  
  <p>So, I call this <code>Init</code> function in my controller's constructor, right along with the database initialization:</p>
  
  <pre><code>SQLitePCL.Batteries.Init();
  
  var dbPath = Path.Combine(Constants.DataDir, "SdgData.sqlite3");
  var sqliteConnection = new SQLiteConnection(dbPath);
  var sdgSqlRepository = new SdgSqlRepository(sqliteConnection);
  crm = new CrmManager(sdgSqlRepository);
  </code></pre>
  
  <p>However, it seems as though the <code>Init</code> isn't even being called - I set a breakpoint on it as well as the next line with the call to <code>Combine</code>, and the second is hit without the first even being noticed.  (Possibly because the <code>Init</code> is a PCL library call not applicable to the ASP.NET platform?)</p>
  
  <p>Is there a way to run SQLite.net PCL in an ASP.NET web application, or am I going to have to look for a different data source?</p>