linq2db - linq2db.Identity 2.0.1-rc57

ASP.NET Core Identity provider that uses LinqToDB.

PM> Install-Package linq2db.Identity -Version 2.0.1-rc57 -Source https://www.myget.org/F/linq2db/api/v3/index.json

Copy to clipboard

> nuget.exe install linq2db.Identity -Version 2.0.1-rc57 -Source https://www.myget.org/F/linq2db/api/v3/index.json

Copy to clipboard

> dotnet add package linq2db.Identity --version 2.0.1-rc57 --source https://www.myget.org/F/linq2db/api/v3/index.json

Copy to clipboard
<PackageReference Include="linq2db.Identity" Version="2.0.1-rc57" />
Copy to clipboard
source https://www.myget.org/F/linq2db/api/v3/index.json

nuget linq2db.Identity  ~> 2.0.1-rc57
Copy to clipboard

> choco install linq2db.Identity --version 2.0.1-rc57 --source https://www.myget.org/F/linq2db/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "linq2db" -SourceLocation "https://www.myget.org/F/linq2db/api/v2"
Install-Module -Name "linq2db.Identity" -RequiredVersion "2.0.1-rc57" -Repository "linq2db" -AllowPreRelease
Copy to clipboard

LinqToDB Identity store provider for ASP.NET Core Identity

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

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 linq2db.Identity

In general this is the same as for Entity Framework, just call AddLinqToDBStores instead of AddEntityFrameworkStores in your Startup.cs like here:

services.AddIdentity<ApplicationUser, IdentityRole>(options => {
    options.Cookies.ApplicationCookie.AuthenticationScheme = "ApplicationCookie";
    options.Cookies.ApplicationCookie.CookieName = "Interop";
    options.Cookies.ApplicationCookie.DataProtectionProvider = DataProtectionProvider.Create(new DirectoryInfo("C:\\Github\\Identity\\artifacts"));
})
    .AddLinqToDBStores(new DefaultConnectionFactory()) //here
    .AddDefaultTokenProviders();

The main difference with Entity Framework Core storage provider are:

  • We do not use hardcoded classes - interfaces like IIdentityUser<TKey> are used (but yes, we do have default implementation)
  • Data connection factory is used for calling to database

Identity and other mapping

We do not use any default mapping attributes on default POCOs (IdentityUser, IdentityRole and so on). This is because this types can be used on different environvents.

If in some reason you prefere using default POCOs you can use fluent mapping in your Startup.cs to define needed attributes.

For example to treat Id as identity:

    LinqToDB.Mapping.MappingSchema.Default.GetFluentMappingBuilder()
        .Entity<IdentityUser<int>>()
        .HasIdentity(_ => _.Id);

Special

All source code is based on original Microsoft Entity Framework Core storage provider for ASP.NET Core Identity.

Tests and sample are just adopted for using LinqToDB. For inmemory storage tests SQLite inmemory database is used.

  • .NETFramework 4.6.1
    • linq2db (>= 3.2.0)
    • Microsoft.AspNetCore.Identity (>= 2.1.2)
    • Microsoft.Extensions.DependencyInjection (>= 2.1.1)
    • Microsoft.Extensions.Identity.Stores (>= 2.1.2)
  • .NETCoreApp 2.1
    • linq2db (>= 3.2.0)
    • Microsoft.AspNetCore.Identity (>= 2.1.2)
    • Microsoft.Extensions.DependencyInjection (>= 2.1.1)
    • Microsoft.Extensions.Identity.Stores (>= 2.1.2)
  • .NETStandard 2.0
    • linq2db (>= 3.2.0)
    • Microsoft.AspNetCore.Identity (>= 2.1.2)
    • Microsoft.Extensions.DependencyInjection (>= 2.1.1)
    • Microsoft.Extensions.Identity.Stores (>= 2.1.2)
  • .NETCoreApp 2.1: 2.1.0.0
  • .NETFramework 4.6.1: 4.6.1.0
  • .NETStandard 2.0: 2.0.0.0

Owners

Ilya Chudin

Authors

Ilya Chudin

Project URL

https://github.com/linq2db/LinqToDB.Identity

License

MIT

Tags

aspnetcore linq2db identity membership LinqToDB

Info

1 total downloads
1 downloads for version 2.0.1-rc57
Download (152.67 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.0.1-rc57 152.67 KB Thu, 17 Dec 2020 10:45:55 GMT 1