Migrate SQLite data to new library

This commit is contained in:
2023-12-31 13:31:46 -05:00
parent e8d63793ba
commit 1a50c68668
12 changed files with 144 additions and 188 deletions

View File

@@ -56,9 +56,6 @@ open MyWebLog.Data
open Newtonsoft.Json
open Npgsql
// The SQLite document library
module Sqlite = BitBadger.Sqlite.FSharp.Documents
/// Logic to obtain a data connection and implementation based on configured values
module DataImplementation =
@@ -176,11 +173,7 @@ let main args =
| :? SQLiteData ->
// ADO.NET connections are designed to work as per-request instantiation
let cfg = sp.GetRequiredService<IConfiguration>()
let _ =
builder.Services.AddScoped<SqliteConnection>(fun sp ->
let conn = Sqlite.Configuration.dbConn ()
conn.OpenAsync() |> Async.AwaitTask |> Async.RunSynchronously
conn)
let _ = builder.Services.AddScoped<SqliteConnection>(fun sp -> Sqlite.Configuration.dbConn ())
let _ = builder.Services.AddScoped<IData, SQLiteData>()
// Use SQLite for caching as well
let cachePath = defaultArg (Option.ofObj (cfg.GetConnectionString "SQLiteCachePath")) "./session.db"