diff --git a/bitbadger-doc.png b/bitbadger-doc.png new file mode 100644 index 0000000..22b1fe2 Binary files /dev/null and b/bitbadger-doc.png differ diff --git a/doc-template/public/main.css b/doc-template/public/main.css new file mode 100644 index 0000000..cfa8c03 --- /dev/null +++ b/doc-template/public/main.css @@ -0,0 +1,4 @@ +article h2 { + border-bottom: solid 1px gray; + margin-bottom: 1rem; +} diff --git a/doc-template/public/main.js b/doc-template/public/main.js new file mode 100644 index 0000000..e60362e --- /dev/null +++ b/doc-template/public/main.js @@ -0,0 +1,10 @@ +export default { + defaultTheme: "auto", + iconLinks: [ + { + icon: "git", + href: "https://git.bitbadger.solutions/bit-badger/BitBadger.Documents", + title: "Source Repository" + } + ] +} \ No newline at end of file diff --git a/docfx.json b/docfx.json index 312c800..1f586b1 100644 --- a/docfx.json +++ b/docfx.json @@ -12,7 +12,10 @@ ] } ], - "dest": "api" + "dest": "api", + "properties": { + "TargetFramework": "net9.0" + } } ], "build": { @@ -29,20 +32,23 @@ "resource": [ { "files": [ - "images/**" + "bitbadger-doc.png" ] } ], "output": "_site", "template": [ "default", - "modern" + "modern", + "doc-template" ], "globalMetadata": { "_appName": "BitBadger.Documents", "_appTitle": "BitBadger.Documents", + "_appLogoPath": "bitbadger-doc.png", + "_appFooter": "Hand-crafted documentation created with docfx by Bit Badger Solutions", "_enableSearch": true, "pdf": false } } -} \ No newline at end of file +} diff --git a/docs/getting-started.md b/docs/getting-started.md index 496f920..3767ac0 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -37,16 +37,16 @@ Both PostgreSQL and SQLite use the standard ADO.NET connection string format ([` ```csharp // C#, SQLite // ... - var config = ...; // parsed IConfiguration - Sqlite.Configuration.UseConnectionString(config.GetConnectionString("SQLite")); +var config = ...; // parsed IConfiguration +Sqlite.Configuration.UseConnectionString(config.GetConnectionString("SQLite")); // ... ``` ```fsharp // F#, SQLite // ... - let config = ...; // parsed IConfiguration - Configuration.useConnectionString (config.GetConnectionString("SQLite")) +let config = ...; // parsed IConfiguration +Configuration.useConnectionString (config.GetConnectionString("SQLite")) // ... ``` @@ -55,18 +55,18 @@ For PostgreSQL, the library needs an `NpgsqlDataSource` instead. There is a buil ```csharp // C#, PostgreSQL // ... - var config = ...; // parsed IConfiguration - var dataSource = new NpgsqlDataSourceBuilder(config.GetConnectionString("Postgres")).Build(); - Postgres.Configuration.UseDataSource(dataSource); +var config = ...; // parsed IConfiguration +var dataSource = new NpgsqlDataSourceBuilder(config.GetConnectionString("Postgres")).Build(); +Postgres.Configuration.UseDataSource(dataSource); // ... ``` ```fsharp // F#, PostgreSQL // ... - let config = ...; // parsed IConfiguration - let dataSource = new NpgsqlDataSourceBuilder(config.GetConnectionString("Postgres")).Build() - Configuration.useDataSource dataSource +let config = ...; // parsed IConfiguration +let dataSource = new NpgsqlDataSourceBuilder(config.GetConnectionString("Postgres")).Build() +Configuration.useDataSource dataSource // ... ``` @@ -80,17 +80,17 @@ For PostgreSQL, the library needs an `NpgsqlDataSource` instead. There is a buil ```csharp // C#, PostgreSQL - builder.Services.AddScoped(svcProvider => - Postgres.Configuration.DataSource().OpenConnection()); +builder.Services.AddScoped(svcProvider => + Postgres.Configuration.DataSource().OpenConnection()); // C#, SQLite - builder.Services.AddScoped(svcProvider => Sqlite.Configuration.DbConn()); +builder.Services.AddScoped(svcProvider => Sqlite.Configuration.DbConn()); ``` ```fsharp // F#, PostgreSQL - let _ = builder.Services.AddScoped Configuration.dataSource().OpenConnection()) +let _ = builder.Services.AddScoped Configuration.dataSource().OpenConnection()) // F#, SQLite - let _ = builder.Services.AddScoped(fun sp -> Configuration.dbConn ()) +let _ = builder.Services.AddScoped(fun sp -> Configuration.dbConn ()) ``` After registering, this connection will be available on the request context and can be injected in the constructor for things like Razor Pages or MVC Controllers. @@ -145,7 +145,7 @@ await Definition.EnsureTable("hotel"); await Definition.EnsureDocumentIndex("hotel", DocumentIndex.Full); await Definition.EnsureTable("room"); // parameters are table name, index name, and fields to be indexed -await Definition.EnsureFieldIndex("room", "hotel_id", new[] { "HotelId" }); +await Definition.EnsureFieldIndex("room", "hotel_id", ["HotelId"]); await Definition.EnsureDocumentIndex("room", DocumentIndex.Optimized); ``` @@ -168,7 +168,7 @@ Let's create hotel and room tables, then index rooms by hotel ID and room number // C#, SQLite await Definition.EnsureTable("hotel"); await Definition.EnsureTable("room"); -await Definition.EnsureIndex("room", "hotel_and_nbr", new[] { "HotelId", "RoomNumber" }); +await Definition.EnsureIndex("room", "hotel_and_nbr", ["HotelId", "RoomNumber"]); ``` ```fsharp