Persistord.Adapters.NetCord
1.0.0-beta.3
dotnet add package Persistord.Adapters.NetCord --version 1.0.0-beta.3
NuGet\Install-Package Persistord.Adapters.NetCord -Version 1.0.0-beta.3
<PackageReference Include="Persistord.Adapters.NetCord" Version="1.0.0-beta.3" />
<PackageVersion Include="Persistord.Adapters.NetCord" Version="1.0.0-beta.3" />
<PackageReference Include="Persistord.Adapters.NetCord" />
paket add Persistord.Adapters.NetCord --version 1.0.0-beta.3
#r "nuget: Persistord.Adapters.NetCord, 1.0.0-beta.3"
#:package Persistord.Adapters.NetCord@1.0.0-beta.3
#addin nuget:?package=Persistord.Adapters.NetCord&version=1.0.0-beta.3&prerelease
#tool nuget:?package=Persistord.Adapters.NetCord&version=1.0.0-beta.3&prerelease
Persistord.Adapters.NetCord
<div align="center">
← Persistord docs · Documentation site
</div>
Opt-in NetCord adapter for Persistord: extension methods mapping NetCord model types to Persistord entities.
The core Persistord packages never reference a Discord client library. Install this package only if your bot uses NetCord.
Install
dotnet add package Persistord.Adapters.NetCord
API
using Persistord.Adapters.NetCord;
using Persistord.History.Entities;
db.Messages.Add(message.ToMessageEntity()); // embeds, attachments, reactions included
db.MessageHistory.Add(message.ToHistoryEntity(HistoryChangeType.Created));
await db.SaveChangesAsync();
| Method | Binds to | Produces |
|---|---|---|
ToGuildEntity() |
RestGuild |
GuildEntity |
ToChannelEntity() |
IGuildChannel |
ChannelEntity |
ToUserEntity() |
User |
UserEntity |
ToMemberEntity() |
GuildUser |
MemberEntity |
ToRoleEntity() |
Role |
RoleEntity |
ToMessageEntity() |
RestMessage |
MessageEntity |
ToHistoryEntity(changeType) |
RestMessage |
MessageHistoryEntity |
Each mapper binds the base type that both the gateway and REST variants derive from,
so Gateway.Guild and Gateway.Message map through the same methods as their Rest*
counterparts.
What the mappers do not touch
Mappers are pure functions over data fields. They never set IsDeleted/DeletedAt,
never set EF-generated surrogate keys (Embed.Id, ReactionEntity.Id), and never set
child foreign keys — children are added to the parent's navigation collection and EF
fills the keys on save. GuildEntity.JoinedAt/LeftAt are also left alone: they track
your bot's membership lifecycle, which your persistence logic owns.
Channel types
NetCord expresses a channel's kind through its class rather than a property, and
Persistord's ChannelType has four members, so the translation collapses NetCord's
channel classes:
| NetCord class | ChannelType |
|---|---|
PublicGuildThread, PrivateGuildThread, AnnouncementGuildThread, ForumGuildThread |
Thread |
VoiceGuildChannel, StageGuildChannel |
Voice |
CategoryGuildChannel |
Category |
TextGuildChannel, AnnouncementGuildChannel, ForumGuildChannel, MediaForumGuildChannel, DirectoryGuildChannel |
Text |
Unrecognised channel classes fall back to Text rather than throwing, so a future
NetCord channel kind will not break a running bot.
Versioning
This package references NetCord as [1.0.0-beta.19, 2.0.0) — a floor, not a pin. The
shipped assembly is compiled against 1.0.0-beta.19; NuGet resolves a range to its
lowest satisfying version, and a consumer's newer direct reference wins.
NetCord has no stable release. Every published version is a prerelease, so this
adapter carries a prerelease dependency. A local dotnet pack with no version
override fails today with NU5104 (stable package with a prerelease
dependency): Directory.Build.props sets a local-build placeholder
<Version>1.0.0</Version>, which NuGet reads as stable, and the repo's
TreatWarningsAsErrors turns that mismatch into a hard pack failure. Prerelease
releases are unaffected — CD.yml packs with -p:Version=$VERSION, and release
tags are themselves prerelease (1.0.0-beta4 and the like), so the stable/prerelease
mismatch never arises there. To pack locally, pass a prerelease version explicitly:
dotnet pack -p:Version=1.0.0-beta.1. When Persistord genuinely publishes a stable
1.0.0, this becomes a real release blocker to resolve then — either by waiting for
NetCord 1.0.0 stable or by shipping this adapter on its own prerelease track —
rather than by suppressing the warning.
| Product | Versions 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. |
-
net10.0
- NetCord (>= 1.0.0-beta.19 && < 2.0.0)
- Persistord.Core (>= 1.0.0-beta.3)
- Persistord.History (>= 1.0.0-beta.3)
- Persistord.Messages (>= 1.0.0-beta.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-beta.3 | 71 | 9/10/2026 |