Lyo.Note.Postgres 3.0.0

dotnet add package Lyo.Note.Postgres --version 3.0.0
                    
NuGet\Install-Package Lyo.Note.Postgres -Version 3.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Lyo.Note.Postgres" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.Note.Postgres" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Lyo.Note.Postgres" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Lyo.Note.Postgres --version 3.0.0
                    
#r "nuget: Lyo.Note.Postgres, 3.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Lyo.Note.Postgres@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Lyo.Note.Postgres&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.Note.Postgres&version=3.0.0
                    
Install as a Cake Tool

Lyo.Note.Postgres

Entity Framework Core store for Lyo.Note on PostgreSQL. Rows live in note.note (PostgresNoteOptions.Schema = "note"), and the package includes migrations. Notes carry subject / actor entity references (for_entity_* / from_entity_*).

PostgresNoteStore implements INoteStore and Lyo.Health.IHealth (HealthCheckName = "note-postgres"). Registering the store also registers a liveness probe.

Examples

Register the store

services.AddPostgresNoteStore(new PostgresNoteOptions {
    ConnectionString = "...",
    EnableAutoMigrations = true
});

appsettings.json

{
  "PostgresNote": {
    "ConnectionString": "Host=localhost;Database=note;...",
    "EnableAutoMigrations": true
  }
}

Bind from configuration

services.AddPostgresNoteStoreFromConfiguration(configuration);

A user notes a docket

await noteStore.SaveAsync(new NoteRecord {
    SubjectEntityType = "Docket",
    SubjectEntityId = docketId.ToString(),
    ActorEntityType = "User",
    ActorEntityId = userId.ToString(),
    Content = "Follow up next week"
});

// Update by passing the same Id back through SaveAsync.
var existing = await noteStore.GetByIdAsync(noteId);
existing!.Content = "Follow up tomorrow";
await noteStore.SaveAsync(existing);

Add a migration

export NOTE_CONNECTION_STRING="Host=localhost;Database=note;Username=postgres;Password=postgres"
dotnet ef migrations add MigrationName --project Plugins/Note/Lyo.Note.Postgres

Service registration

  • AddNoteDbContextFactory(Action<PostgresNoteOptions>) / AddNoteDbContextFactory(PostgresNoteOptions) register the IDbContextFactory<NoteDbContext> only.
  • AddNoteDbContextFactoryFromConfiguration(IConfiguration, string sectionName = PostgresNoteOptions.SectionName) does the same, bound from configuration. Default section: PostgresNote.
  • AddPostgresNoteStore(Action<PostgresNoteOptions>) / AddPostgresNoteStore(PostgresNoteOptions) register the DbContext factory and the INoteStore singleton.
  • AddPostgresNoteStoreFromConfiguration(IConfiguration, string sectionName = PostgresNoteOptions.SectionName) registers the store by binding configuration.

From configuration

The same registration from configuration:

Building an EntityRef

Create refs with Lyo.EntityReference.Models.EntityRef, either generic or from strings:

// Generic: uses typeof(T).FullName, keys joined with ":"
var forDocket = EntityRef.For<Docket>(docketId);
var fromUser = EntityRef.For<User>(123);
var composite = EntityRef.For<Order>("ord-1", "line-2");

// String-based
var forEntity = EntityRef.ForGuid("Docket", docketGuid);
var fromEntity = EntityRef.ForKey("User", "123");

Database schema

  • note.note. EntityRelationEntityBase: id (uuid), subject/actor columns (for_entity_type, for_entity_id, from_entity_type, from_entity_id, nullable varchar 128/256), tenant_id, context, visibility, created_at, expires_at, deleted_at, deleted_by_type, deleted_by_id, metadata (jsonb), plus note-specific content and updated_timestamp.

Tenant isolation

Every read and write on PostgresNoteStore takes an optional Guid? tenantId. TenancyResolver applies the policy in PostgresNoteOptions.Tenancy. When that is unset, it inherits EntityRefOptions.Mode. Because tenant_id is non-null, only SingleTenantDefault and MultiTenantStrict are valid. Construction rejects SystemOnly. Every query gets a WhereTenant filter, so one tenant's notes cannot appear in another. The policy matrix and an appsettings.json snippet live in Lyo.EntityReference.Postgres.

{
  "PostgresNote": {
    "ConnectionString": "Host=localhost;Database=lyo;...",
    "Tenancy": { "Mode": "MultiTenantStrict" }
  }
}

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.EntityReference.Models (direct, lyo)
  • Lyo.EntityReference.Postgres (direct, lyo)
  • Lyo.Exceptions (direct, lyo)
  • Lyo.Health (direct, lyo)
  • Lyo.Note (direct, lyo)
  • Lyo.Postgres (direct, lyo)
  • Lyo.Search.Postgres (direct, lyo)
  • Microsoft.EntityFrameworkCore 10.0.5 (direct, microsoft)
  • Microsoft.EntityFrameworkCore.Design 10.0.5 (direct, microsoft)
  • Microsoft.Extensions.Configuration.Binder 10.0.5 (direct, microsoft)
  • Lyo.Common.Core (transitive, lyo)
  • Microsoft.Bcl.AsyncInterfaces 10.0.5 (transitive, microsoft, netstandard2.0)
  • Microsoft.EntityFrameworkCore.Relational 10.0.5 (transitive, microsoft)
  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.5 (transitive, microsoft)
  • Microsoft.Extensions.Hosting.Abstractions 10.0.5 (transitive, microsoft)
  • Microsoft.Extensions.Options 10.0.5 (transitive, microsoft)
  • Microsoft.Extensions.Options.ConfigurationExtensions 10.0.5 (transitive, microsoft)
  • Npgsql.EntityFrameworkCore.PostgreSQL 10.0.3 (transitive, third-party)
  • System.Memory 4.6.3 (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 (transitive, microsoft, netstandard2.0)
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Lyo.Note.Postgres:

Package Downloads
Lyo.HomeInventory.Api

HTTP API surface for Lyo HomeInventory: categories, locations, items, stock, attachments, notes, and tags.

Lyo.Recipe.Api

HTTP API surface for Lyo Recipe: categories, ingredients, recipes, lines, steps, attachments, notes, and tags.

Lyo.Note.Seed

EF seed of notes on a fixed seed subject.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 85 10/23/2026
2.0.1 113 9/14/2026
2.0.0 118 9/9/2026
1.0.13 120 8/25/2026
1.0.11 114 8/23/2026
1.0.9 118 8/22/2026
1.0.6 119 8/20/2026
1.0.4 120 8/20/2026
1.0.3 119 8/19/2026
1.0.2 124 8/19/2026
1.0.1 123 8/18/2026
1.0.0 121 8/16/2026