Hi,
I recently found a strange situation,as title.
If I connect Sqlite by Entity Framework Core, just like:
public class DatabaseContext : DbContext { protected string _databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Test_Database.db3"); protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { optionsBuilder.UseSqlite($"Filename={_databasePath}"); } } public DbSet<TestM> database_Test { get; set; } }
The database file will build in "C:\Users\User\AppData\Local\Packages***\LocalState\" .
but,
If I use the basic way to connect Sqlite like this:
public TestData() { if (database_Test == null) { dbPath= new TestM(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Test_Database.db3")); database_Test = new SQLiteAsyncConnection(dbPath); } database_Test.CreateTableAsync<TestM>().Wait(); }
The database will build 3 files in "C:\Users\User\AppData\Local\Packages***\LocalState\" .
file:
Test_Database.db3 Test_Database.db3-shm Test_Database.db3-wal
and data is save in the db3-wal file.(through observing the file capacity to guess)
On the other hand,
when I use EF core to connect "Test_Database.db3-wal" , can't connect the DataBase created by direct connection,
I thought it may be share same data if I connect same file.
or I make a mistake somewhere? like create different Table name?