Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.



Repository files navigation


  • Current build status Build status
  • Master build status Master status


IdentityServer4.LinqToDB is a persistence layer for IdentityServer4 configuration data that uses Linq To DB as it's database abstraction.

Project's source code is originally based on IdentityServer4.EntityFramework


  • Release builds can be found on NuGet
  • MyGet
    • V2
    • V3


Install package:

PM> Install-Package IdentityServer4.Contrib.Linq2db


All POCOs are under IdentityServer4.Contrib.LinqToDB.Entities namespace. Mostly POCOs are inherited from IdentityServer4.Models.* classes (to avoid unnesesary mapping), with adding only Id properties for identities and foreign keys. IdentityServer4.Models.Client.ClientId is used as promary key for Client entity. All Id's are identity by default.


Firstly you should create your connection factory as implementation of IdentityServer4.LinqToDB.Interfaces.IDataConnectionFactory, for example:

public class MyConnectionFactory : IDataConnectionFactory
    public DataContext GetContext() => new DataContext();
    public DataConnection GetConnection() => new DataConnection();

In your Strartup.cs

public IServiceProvider ConfigureServices(IServiceCollection services)
    // ...
    // create factory instance 
    var factory = new MyConnectionFactory();

    services.AddIdentityServer() // Add IdentityServer
        // some other stuff

        // Configure Linq To DB storage for IdentityServer

    // ...
    return services.BuildServiceProvider(true);


No packages published


  • C# 92.9%
  • PowerShell 4.0%
  • Shell 1.9%
  • CSS 1.1%
  • JavaScript 0.1%