Persistord.Core 1.0.0-beta2

This is a prerelease version of Persistord.Core.
dotnet add package Persistord.Core --version 1.0.0-beta2
                    
NuGet\Install-Package Persistord.Core -Version 1.0.0-beta2
                    
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="Persistord.Core" Version="1.0.0-beta2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Persistord.Core" Version="1.0.0-beta2" />
                    
Directory.Packages.props
<PackageReference Include="Persistord.Core" />
                    
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 Persistord.Core --version 1.0.0-beta2
                    
#r "nuget: Persistord.Core, 1.0.0-beta2"
                    
#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 Persistord.Core@1.0.0-beta2
                    
#: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=Persistord.Core&version=1.0.0-beta2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Persistord.Core&version=1.0.0-beta2&prerelease
                    
Install as a Cake Tool

Persistord.Core

<div align="center">

NuGet Downloads

← Persistord docs · Documentation site

</div>

Foundation package for Persistord, a provider-agnostic, Discord-library-agnostic persistence layer for Discord bots built on EF Core 10.

Persistord.Core ships:

  • Snowflake conversion — Discord ids are ulong; relational providers store signed long. UlongToLongConverter / NullableUlongToLongConverter perform a bit-faithful unchecked round-trip, so every value (including ids with the high bit set) survives storage exactly. The conversion is registered globally in DiscordDbContext.ConfigureConventions, so you never annotate individual ids.
  • DiscordDbContext — an abstract base context that maps the core skeleton entities (GuildEntity, ChannelEntity, UserEntity, MemberEntity, RoleEntity) and applies the snowflake convention. Inherit it, add the module DbSets you want, and apply module configurations in OnModelCreating.
  • ApplyCoreConfiguration() — a ModelBuilder extension that wires the core entity configurations. DiscordDbContext calls it for you.

Provider-agnostic by design

The library never selects a database provider. It defines the model only. You choose the provider in your own composition root:

services.AddDbContextFactory<MyBotContext>(o => o.UseNpgsql(connectionString));
// or .UseSqlite(...), .UseSqlServer(...), etc.

Context lifetime

A Discord bot is long-lived and highly concurrent. Do not hold a single DbContext for the bot's lifetime — its change tracker grows unbounded and it is not thread-safe. Use IDbContextFactory<T> and create a short-lived context per unit of work (per gateway event, per command):

await using var db = await factory.CreateDbContextAsync();
db.Guilds.Add(new GuildEntity { Id = guildId, Name = name, OwnerId = ownerId });
await db.SaveChangesAsync();

Snowflake storage note

Snowflakes are stored as long. Discord snowflakes stay below long.MaxValue until roughly the year 2084, so signed storage is safe; the converter is nevertheless bit-faithful and would round-trip even past that point.

License

MIT

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 Persistord.Core:

Package Downloads
Persistord

Meta package that bundles the library-neutral Persistord stack — Core, Messages, and History — in a single reference.

Persistord.Messages

Message persistence module for Persistord: MessageEntity with soft-delete, owned Embed model, relational attachments and reactions.

Persistord.Adapters.DiscordNet

Discord.Net adapter for Persistord: extension methods mapping Discord.Net interface types to Persistord entities.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-beta2 198 7/20/2026
1.0.0-beta.1 244 6/14/2026