IdentityLinker.EntityFrameworkCore
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package IdentityLinker.EntityFrameworkCore --version 1.0.0
NuGet\Install-Package IdentityLinker.EntityFrameworkCore -Version 1.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="IdentityLinker.EntityFrameworkCore" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IdentityLinker.EntityFrameworkCore" Version="1.0.0" />
<PackageReference Include="IdentityLinker.EntityFrameworkCore" />
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 IdentityLinker.EntityFrameworkCore --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: IdentityLinker.EntityFrameworkCore, 1.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 IdentityLinker.EntityFrameworkCore@1.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=IdentityLinker.EntityFrameworkCore&version=1.0.0
#tool nuget:?package=IdentityLinker.EntityFrameworkCore&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
IdentityLinker.EntityFrameworkCore
IdentityLinker 框架的 Entity Framework Core 持久化存储实现,支持 SQL Server、PostgreSQL 等多种数据库。
安装
dotnet add package IdentityLinker.EntityFrameworkCore
功能特性
- 配置数据库上下文 —
ConfigurationDbContext存储客户端、资源、身份提供商等配置数据 - 操作数据库上下文 —
PersistedGrantDbContext存储授权码、刷新令牌、设备流等运行时数据 - 11 种存储实现 — ClientStore、ResourceStore、PersistedGrantStore、DeviceFlowStore 等
- SAML 持久化 — SamlServiceProviderStore、SamlSigninStateStore、SamlLogoutSessionStore
- 服务器端会话 — ServerSideSessionStore
- 推送授权 — PushedAuthorizationRequestStore
包依赖
| 包 | 版本 |
|---|---|
| IdentityLinker.Abstractions | * |
| Microsoft.EntityFrameworkCore.Relational | 10.0.1 |
使用示例
配置 SQL Server
var connectionString = builder.Configuration.GetConnectionString("Default");
// 注册配置数据库
builder.Services.AddIdentityLinker()
.AddConfigurationDbContext(options =>
options.ConfigureDbContext = b =>
b.UseSqlServer(connectionString,
sql => sql.MigrationsAssembly(typeof(ConfigurationDbContext).Assembly.FullName)));
// 注册操作数据库
builder.Services.AddOperationalDbContext(options =>
options.ConfigureDbContext = b =>
b.UseSqlServer(connectionString,
sql => sql.MigrationsAssembly(typeof(PersistedGrantDbContext).Assembly.FullName)));
配置 PostgreSQL
builder.Services.AddIdentityLinker()
.AddConfigurationDbContext(options =>
options.ConfigureDbContext = b => b.UseNpgsql(connectionString));
builder.Services.AddOperationalDbContext(options =>
options.ConfigureDbContext = b => b.UseNpgsql(connectionString));
自定义 DbContext
public class CustomConfigurationDbContext : ConfigurationDbContext<CustomConfigurationDbContext>
{
public CustomConfigurationDbContext(DbContextOptions<CustomConfigurationDbContext> options)
: base(options) { }
}
builder.Services.AddConfigurationDbContext<CustomConfigurationDbContext>(
options => options.ConfigureDbContext = b => b.UseSqlServer(connectionString));
令牌清理
// 托管服务自动清理过期授权和令牌
// 配置清理间隔
builder.Services.AddIdentityLinker(options =>
{
options.PersistentGrants.DataProtectData = true;
});
使用 EF Core 持久化前请确保运行数据库迁移:dotnet ef database update
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Duende.IdentityModel (>= 8.0.0)
- IdentityLinker.Abstractions (>= 1.0.0)
- Microsoft.AspNetCore.DataProtection.Abstractions (>= 10.0.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.10)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.1)
- Microsoft.IdentityModel.Tokens (>= 8.19.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on IdentityLinker.EntityFrameworkCore:
| Package | Downloads |
|---|---|
|
IdentityLinker.Configuration.EntityFrameworkCore
IdentityLinker 动态客户端注册元数据和 registration access token 的 Entity Framework Core 持久化。 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-preview.2 | 75 | 8/4/2026 |
| 3.0.0-preview.1 | 72 | 7/29/2026 |
| 2.0.0 | 126 | 7/18/2026 |
| 1.0.0 | 131 | 6/6/2026 |
| 1.0.0-preview.2 | 256 | 12/19/2025 |