title: Entity Framework 4.1 and SQLite
body: <p>I'am using SQLite database and Entity Framework 4.1 Code First.</p>
  
  <p>The following error occurred when <code>db.SaveChanges</code> called
  <code>System.Data.EntityException: The underlying provider failed on Open. ---&gt; System.Data.SQLite.SQLiteException: The database file is locked</code></p>
  
  <p>My code:</p>
  
  <pre><code>using (var db = new Dal.Database())
  {
      var newObj = db.Sheet.FirstOrDefault(e =&gt; e.SheetId == SheetId);
      if (newObj == null)
          newObj = new Dal.Sheet();
  
      newObj.SheetTypeCode = SheetTypeCode;
      newObj.SheetCount = SheetCount;
  
      db.Sheet.Add(newObj);
      db.SaveChanges();
  }
  </code></pre>
  
  <p>Please, help me.
  Thanks</p>