title: SQLite query failing but only when offline
body: <p>I have a simple SQLite method which returns a class given two parameters - the type T and the parameter value to be searched</p>
  
  <pre><code>public T GetSingleObject&lt;T&gt;(string id) where T:IIdentity, new()
      {
          lock (dbLock)
          {
              using (var sqlCon = new SQLiteConnection(DBPath))
              {
                  sqlCon.Execute(Constants.DBClauseSyncOff);
                  sqlCon.BeginTransaction();
                  string sql = string.Format("SELECT * FROM {0} WHERE id=\"{1}\"", GetName(typeof(T).ToString()), id);
                  var data = sqlCon.Query&lt;T&gt;(sql);
                  return data[0];
              }
          }
      }
  </code></pre>
  
  <p>I also have another method that takes 3 parameters, T, the parameter to be seated and the value to search for</p>
  
  <pre><code>public T GetSingleObject&lt;T&gt;(string para, string val) where T:IIdentity, new()
      {
          lock (dbLock)
          {
              using (var sqlCon = new SQLiteConnection(DBPath))
              {
                  sqlCon.Execute(Constants.DBClauseSyncOff);
                  sqlCon.BeginTransaction();
                  string sql = string.Format("SELECT * FROM {0} WHERE {1}=\"{2}\"", GetName(typeof(T).ToString()), para, val);
                  var data = sqlCon.Query&lt;T&gt;(sql).FirstOrDefault();
                  return data;
              }
          }
      }
  </code></pre>
  
  <p>These methods work without an issue and return the values expected, but with one caveat - there is a single table which works fine when the phone has a connection, but not when it's in aeroplane mode. The table has nothing more in it than strings, doubles, ints, DateTime and bool values. </p>
  
  <p>GetName is a simple method that removes the assembly bits and pieces and leave just the classname</p>
  
  <pre><code> private string GetName(string name)
      {
          var list = name.Split('.').ToList();
          if (list.Count == 1)
              return list[0];
          var last = list[list.Count - 1];
          return last;
      } 
  </code></pre>
  
  <p>I have tried every way I can think of to access this table - including a straight</p>
  
  <pre><code>sqlCon.ExecuteScalar&lt;MyClass&gt;("SELECT * FROM MyClass");
  </code></pre>
  
  <p>and nothing offline, perfect data online.</p>
  
  <p>The class itself looks like this</p>
  
  <pre><code>using System;
  using System.Runtime.Serialization;
  using System.Collections.Generic;
  using SQLite;
  
  namespace Models
  {
  public class MyClass : IIdentity
  {
      [PrimaryKey]
      public string id { get; set; }
  
      public string home_id { get; set; }
  
      public string username { get; set; }
  
      public string password { get; set; }
  
      public string firstname { get; set; }
  
      public string lastname { get; set; }
  
      public string email { get; set; }
  
      public bool syncenabled { get; set; }
  
      public string tradingname { get; set; }
  
      public string address { get; set; }
  
      public string town { get; set; }
  
      public string state { get; set; }
  
      public string country { get; set; }
  
      public string securitystamp { get; set; }
  
      public string password_question { get; set; }
  
      public string password_answer { get; set; }
  
      public string mobileServiceAuthenticationToken { get; set; }
  
      public string providerUserKey { get; set; }
  
      public string mobiledeviceid { get; set; }
  
      public DateTime last_login { get; set; }
  
      public DateTime __createdAt { get; set; }
  
      public DateTime __updatedAt { get; set; }
  
      public string user_type { get; set; }
  
      public bool is_deleted { get; set; }
  
      public bool account_enabled { get; set; }
  
      public string subscription_id { get; set; }
  
      [IgnoreDataMember, Ignore]
      public List&lt;MyUsers&gt; UserModules { get { return AppDelegate.Self.DBManager.GetListOfObjects&lt;MyUsers&gt;("user_id", id); } }
  
      public override string ToString()
      {
          return string.Format("[MyClasss: id={0}, home_id={1}, username={2}, password={3}, firstname={4}, lastname={5}, email={6}, syncenabled={7}, tradingname={8}, address={9}, town={10}, state={11}, country={12}, securitystamp={13}, password_question={14}, password_answer={15}, mobileServiceAuthenticationToken={16}, providerUserKey={17}, mobiledeviceid={18}, last_login={19}, __createdAt={20}, __updatedAt={21}, user_type={22}, is_deleted={23}, account_enabled={24}, subscription_id={25}, UserModules={26}]", id, home_id, username, password, firstname, lastname, email, syncenabled, tradingname, address, town, state, country, securitystamp, password_question, password_answer, mobileServiceAuthenticationToken, providerUserKey, mobiledeviceid, last_login, __createdAt, __updatedAt, user_type, is_deleted, account_enabled, subscription_id, UserModules);
      }
  }
  </code></pre>
  
  <p>Nothing in there that I can see should cause an issue when offline. The query always returns null offline, data online.</p>