Before I invest the time in modifying the SubSonic 3 source, I figured I ask to see if I'm missing something simple.
Is it possible to use the SubSonic 3 Repository with migrations on a SQLite In-Memory database? I couldn't find a way to force the DbDataProvider to keep the connection open so the In-Memory SQLite database doesn't vanish when the connection get's closed.
The unit test with the connection string I was trying is...
public class SQLite_InMemory_SimpleRepositoryTests
{
public class Job
{
public Guid JobId { get; set; }
public string JobName { get; set; }
}
[Fact]
public void SQLite_InMemory_SimpleRepo_CanStayOpen()
{
IDataProvider provider = ProviderFactory.GetProvider("Data Source=:memory:;Version=3;New=True;Pooling=True;Max Pool Size=1;", "System.Data.SQLite");
IRepository repository = new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations);
for (int i = 0; i < 10000; i++)
{
var job = new Job {JobId = Guid.NewGuid(), JobName = "Job_"+i};
repository.Add(job);
}
}
}
I tried setting the "Shared Connection" on the IDataProvider, but the connection still seemed to close.
If not, I'll update the SubSonic source, and submit the changes.
Thanks!