title: How to map C# object to SQLite database table?
body: <p>I have the following SQLite table </p>
  
  <p><a href="https://i.stack.imgur.com/98CV4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/98CV4.png" alt="enter image description here"></a></p>
  
  <p>And I have the following C# classes:</p>
  
  <pre><code>[XmlRoot(ElementName = "articlessql", Namespace = "http://tempuri.org/DataSet1.xsd")]
  public class Article
  {
      [XmlElement(ElementName = "id", Namespace = "http://tempuri.org/DataSet1.xsd")]
      public string Id { get; set; }
      [XmlElement(ElementName = "name", Namespace = "http://tempuri.org/DataSet1.xsd")]
      public string Name { get; set; }
      [XmlElement(ElementName = "quantity", Namespace = "http://tempuri.org/DataSet1.xsd")]
      public string Quantity { get; set; }
      [XmlElement(ElementName = "sell_price", Namespace = "http://tempuri.org/DataSet1.xsd")]
      public string SellPrice { get; set; }
      [XmlElement(ElementName = "sellid", Namespace = "http://tempuri.org/DataSet1.xsd")]
      public string SellId { get; set; }
      [XmlElement(ElementName = "whole_price", Namespace = "http://tempuri.org/DataSet1.xsd")]
      public string WholePrice { get; set; }
      [XmlElement(ElementName = "group", Namespace = "http://tempuri.org/DataSet1.xsd")]
      public string Group { get; set; }
      [XmlElement(ElementName = "barcode", Namespace = "http://tempuri.org/DataSet1.xsd")]
      public string Barcode { get; set; }
      [XmlElement(ElementName = "measure", Namespace = "http://tempuri.org/DataSet1.xsd")]
      public string Measure { get; set; }
  }
  
  [XmlRoot(ElementName = "DataSet1", Namespace = "http://tempuri.org/DataSet1.xsd")]
  public class Articles
  {
      [XmlElement(ElementName = "articlessql", Namespace = "http://tempuri.org/DataSet1.xsd")]
      public List&lt;Article&gt; AllArticles { get; set; }
      [XmlAttribute(AttributeName = "xmlns")]
      public string Xmlns { get; set; }
  }
  </code></pre>
  
  <p>I get list of articles like that:</p>
  
  <pre><code>XmlSerializer deserializer = new XmlSerializer(typeof(Articles));
  TextReader textReader = new StreamReader(xmlFilePath);
  Articles articles = new Articles();
  articles = (Articles)deserializer.Deserialize(textReader);
  textReader.Close();
  </code></pre>
  
  <p>But when I try to insert the list of articles in the table <code>articles</code> like that:</p>
  
  <pre><code>using (var connection = new SQLiteConnection(System.IO.Path.Combine(apkFolder, "MobileSell.db")))
  {
      connection.InsertAll(articles.AllArticles);
  }
  </code></pre>
  
  <p>It throws exception:</p>
  
  <pre><code>SQLite.SQLiteException: no such table: Article at SQLite.SQLite3.Prepare2
  </code></pre>
  
  <p>My question is how can I make the program understand that Article object must be a single row in table <code>articles</code></p>