Add template tweaks to docfx site
This commit is contained in:
parent
037c668ae3
commit
f80914daef
BIN
bitbadger-doc.png
Normal file
BIN
bitbadger-doc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
4
doc-template/public/main.css
Normal file
4
doc-template/public/main.css
Normal file
@ -0,0 +1,4 @@
|
||||
article h2 {
|
||||
border-bottom: solid 1px gray;
|
||||
margin-bottom: 1rem;
|
||||
}
|
10
doc-template/public/main.js
Normal file
10
doc-template/public/main.js
Normal file
@ -0,0 +1,10 @@
|
||||
export default {
|
||||
defaultTheme: "auto",
|
||||
iconLinks: [
|
||||
{
|
||||
icon: "git",
|
||||
href: "https://git.bitbadger.solutions/bit-badger/BitBadger.Documents",
|
||||
title: "Source Repository"
|
||||
}
|
||||
]
|
||||
}
|
14
docfx.json
14
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 <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,
|
||||
"pdf": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<NpgsqlConnection>(svcProvider =>
|
||||
Postgres.Configuration.DataSource().OpenConnection());
|
||||
builder.Services.AddScoped<NpgsqlConnection>(svcProvider =>
|
||||
Postgres.Configuration.DataSource().OpenConnection());
|
||||
// C#, SQLite
|
||||
builder.Services.AddScoped<SqliteConnection>(svcProvider => Sqlite.Configuration.DbConn());
|
||||
builder.Services.AddScoped<SqliteConnection>(svcProvider => Sqlite.Configuration.DbConn());
|
||||
```
|
||||
|
||||
```fsharp
|
||||
// F#, PostgreSQL
|
||||
let _ = builder.Services.AddScoped<NpgsqlConnection(fun sp -> Configuration.dataSource().OpenConnection())
|
||||
let _ = builder.Services.AddScoped<NpgsqlConnection(fun sp -> Configuration.dataSource().OpenConnection())
|
||||
// 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.
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user