Closed akucheck closed 5 years ago
Hello @akucheck, looks like you are running tabula-rasa project. Setting the connection string happens in here in case you using the local database, which uses the absolute file name of the databse as the connection string.
You can override that and use the following instead:
let createDatabaseUsing store =
let mapper = FSharpBsonMapper()
match store with
| Store.InMemory ->
let memoryStream = new System.IO.MemoryStream()
new LiteDatabase(memoryStream, mapper)
| Store.LocalDatabase ->
let dbFile = Environment.databaseFilePath
// extend the connection string here
let connectionString = sprintf "Filename=%s; Mode=Exclusive" dbFile
new LiteDatabase(connectionString , mapper)
Can you check whether this fixes the problem for you?
It does indeed fix the problem. Thanks much!
On to playing with this puppy to learn more about SAFE-stack.
ak
On Sun, Feb 17, 2019 at 5:20 PM Zaid Ajaj notifications@github.com wrote:
Hello @akucheck https://github.com/akucheck, looks like you are running tabula-rasa project. Setting the connection string happens in here https://github.com/Zaid-Ajaj/tabula-rasa/blob/master/Server/Storage.fs#L31-L33 in case you using the local database, which uses the absolute file name of the databse as the connection string.
You can override that and use the following instead:
let createDatabaseUsing store = let mapper = FSharpBsonMapper() match store with | Store.InMemory -> let memoryStream = new System.IO.MemoryStream() new LiteDatabase(memoryStream, mapper) | Store.LocalDatabase -> let dbFile = Environment.databaseFilePath // extend the connection string here let connectionString = sprintf "Filename=%s; Mode=Exclusive" dbFile new LiteDatabase(connectionString , mapper)
Can you check whether this fixes the problem for you?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Zaid-Ajaj/LiteDB.FSharp/issues/23#issuecomment-464542698, or mute the thread https://github.com/notifications/unsubscribe-auth/AADvyvC_vxILuknk7cRgiaJKv8HuKEbPks5vOf_AgaJpZM4a_6tx .
It appears that LiteDB now needs a config setting for mode=exclusive on MacOS. I cannot find a way to do this. On initial load, once compile has finished I'm getting this: