Add template tweaks to docfx site

This commit is contained in:
Daniel J. Summers 2025-04-11 21:27:12 -04:00
parent 037c668ae3
commit f80914daef
5 changed files with 41 additions and 21 deletions

BIN
bitbadger-doc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,4 @@
article h2 {
border-bottom: solid 1px gray;
margin-bottom: 1rem;
}

View File

@ -0,0 +1,10 @@
export default {
defaultTheme: "auto",
iconLinks: [
{
icon: "git",
href: "https://git.bitbadger.solutions/bit-badger/BitBadger.Documents",
title: "Source Repository"
}
]
}

View File

@ -12,7 +12,10 @@
] ]
} }
], ],
"dest": "api" "dest": "api",
"properties": {
"TargetFramework": "net9.0"
}
} }
], ],
"build": { "build": {
@ -29,18 +32,21 @@
"resource": [ "resource": [
{ {
"files": [ "files": [
"images/**" "bitbadger-doc.png"
] ]
} }
], ],
"output": "_site", "output": "_site",
"template": [ "template": [
"default", "default",
"modern" "modern",
"doc-template"
], ],
"globalMetadata": { "globalMetadata": {
"_appName": "BitBadger.Documents", "_appName": "BitBadger.Documents",
"_appTitle": "BitBadger.Documents", "_appTitle": "BitBadger.Documents",
"_appLogoPath": "bitbadger-doc.png",
"_appFooter": "Hand-crafted documentation created with <a href=https://dotnet.github.io/docfx target=_blank class=external>docfx</a> by <a href=https://bitbadger.solutions target=_blank class=external>Bit Badger Solutions</a>",
"_enableSearch": true, "_enableSearch": true,
"pdf": false "pdf": false
} }

View File

@ -37,16 +37,16 @@ Both PostgreSQL and SQLite use the standard ADO.NET connection string format ([`
```csharp ```csharp
// C#, SQLite // C#, SQLite
// ... // ...
var config = ...; // parsed IConfiguration var config = ...; // parsed IConfiguration
Sqlite.Configuration.UseConnectionString(config.GetConnectionString("SQLite")); Sqlite.Configuration.UseConnectionString(config.GetConnectionString("SQLite"));
// ... // ...
``` ```
```fsharp ```fsharp
// F#, SQLite // F#, SQLite
// ... // ...
let config = ...; // parsed IConfiguration let config = ...; // parsed IConfiguration
Configuration.useConnectionString (config.GetConnectionString("SQLite")) Configuration.useConnectionString (config.GetConnectionString("SQLite"))
// ... // ...
``` ```
@ -55,18 +55,18 @@ For PostgreSQL, the library needs an `NpgsqlDataSource` instead. There is a buil
```csharp ```csharp
// C#, PostgreSQL // C#, PostgreSQL
// ... // ...
var config = ...; // parsed IConfiguration var config = ...; // parsed IConfiguration
var dataSource = new NpgsqlDataSourceBuilder(config.GetConnectionString("Postgres")).Build(); var dataSource = new NpgsqlDataSourceBuilder(config.GetConnectionString("Postgres")).Build();
Postgres.Configuration.UseDataSource(dataSource); Postgres.Configuration.UseDataSource(dataSource);
// ... // ...
``` ```
```fsharp ```fsharp
// F#, PostgreSQL // F#, PostgreSQL
// ... // ...
let config = ...; // parsed IConfiguration let config = ...; // parsed IConfiguration
let dataSource = new NpgsqlDataSourceBuilder(config.GetConnectionString("Postgres")).Build() let dataSource = new NpgsqlDataSourceBuilder(config.GetConnectionString("Postgres")).Build()
Configuration.useDataSource dataSource Configuration.useDataSource dataSource
// ... // ...
``` ```
@ -80,17 +80,17 @@ For PostgreSQL, the library needs an `NpgsqlDataSource` instead. There is a buil
```csharp ```csharp
// C#, PostgreSQL // C#, PostgreSQL
builder.Services.AddScoped<NpgsqlConnection>(svcProvider => builder.Services.AddScoped<NpgsqlConnection>(svcProvider =>
Postgres.Configuration.DataSource().OpenConnection()); Postgres.Configuration.DataSource().OpenConnection());
// C#, SQLite // C#, SQLite
builder.Services.AddScoped<SqliteConnection>(svcProvider => Sqlite.Configuration.DbConn()); builder.Services.AddScoped<SqliteConnection>(svcProvider => Sqlite.Configuration.DbConn());
``` ```
```fsharp ```fsharp
// F#, PostgreSQL // F#, PostgreSQL
let _ = builder.Services.AddScoped<NpgsqlConnection(fun sp -> Configuration.dataSource().OpenConnection()) let _ = builder.Services.AddScoped<NpgsqlConnection(fun sp -> Configuration.dataSource().OpenConnection())
// F#, SQLite // F#, SQLite
let _ = builder.Services.AddScoped<SqliteConnection>(fun sp -> Configuration.dbConn ()) let _ = builder.Services.AddScoped<SqliteConnection>(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. 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.EnsureDocumentIndex("hotel", DocumentIndex.Full);
await Definition.EnsureTable("room"); await Definition.EnsureTable("room");
// parameters are table name, index name, and fields to be indexed // 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); 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 // C#, SQLite
await Definition.EnsureTable("hotel"); await Definition.EnsureTable("hotel");
await Definition.EnsureTable("room"); await Definition.EnsureTable("room");
await Definition.EnsureIndex("room", "hotel_and_nbr", new[] { "HotelId", "RoomNumber" }); await Definition.EnsureIndex("room", "hotel_and_nbr", ["HotelId", "RoomNumber"]);
``` ```
```fsharp ```fsharp