Thanks very much.  That solved that problem.  I'm seeing a similar issue
when using an EntityFramework open:

            using (var testEntities = new
SystemDataSQLiteTest.TestEntities(connectionString))
            {
                var users = testEntities.Users.ToArray();

                Assert.IsTrue(users.Any());
            }

            File.Delete(TmpDatabase);

The File.Delete() fails with the same issue as above (System.IO.Exception:
The process cannot access the file...because it is being used by another
process.)

Thanks for any help with this.
--
Michael Russell
MTI Film, LLC
michael.russ...@mtifilm.com
http://www.mtifilm.com/
Providence, RI 02906 USA
+1 (401) 831-1315


On Fri, Jan 4, 2013 at 3:07 PM, Joe Mistachkin <sql...@mistachkin.com>wrote:

>
> Michael Russell wrote:
> >
> >  We were previously using 1.0.79.0, but in an attempt to move to VS2012 /
> > .NET 4.5 I started doing some testing with 1.0.83.0.  I found that many
> of
> > our UnitTests now fail when they try to delete the temporary test
> database
> > file they created.  This happens with the SQLiteConnection() call.  I can
> > provide a complete VS project, but here's a code snippet that has the
> > crucial parts:
> >
>
> The change was to keep the underlying native connection open until all
> other
> native objects that refer to it have been disposed.
>
> >
> > var sqlCommand = new SQLiteCommand(connection)
> > {
> >  CommandText = "SELECT * from User where Username='administrator'"
> > };
> >
>
> If you make sure and dispose of all SQLiteCommand and SQLiteDataReader
> objects
> associated with a particular connection, you should not see any issue.
>
> --
> Joe Mistachkin
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to