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

linq2db/IdentityServer4.LinqToDB

 
 

Repository files navigation

IdentityServer4.LinqToDB

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

Intro

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

Feeds

  • Release builds can be found on NuGet
  • MyGet
    • V2 https://www.myget.org/F/linq2db/api/v2
    • V3 https://www.myget.org/F/linq2db/api/v3/index.json

Usage

Install package:

PM> Install-Package IdentityServer4.Contrib.Linq2db

POCOs

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.

Running

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
        .AddTemporarySigningCredential()
        // some other stuff

        // Configure Linq To DB storage for IdentityServer
        .AddConfigurationStore(factory)
        .AddOperationalStore(factory);

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

Packages

No packages published

Languages

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