ASP.NET Core Identity provider that uses LinqToDB.
Перейти к файлу
MaceWindu a9ca319f1c
- replace old TFMs with ns2.0 (#26)
- rebuild against linq2db 5.4.1
2024-07-08 16:36:36 +02:00
build ci 2017-11-28 01:32:18 +05:00
samples v3.4.0 2022-12-17 14:20:13 +01:00
src/LinqToDB.Identity - replace old TFMs with ns2.0 (#26) 2024-07-08 16:36:36 +02:00
test v3.2.0 2020-12-17 11:43:17 +01:00
.gitattributes Build with dotnet 2016-01-15 14:18:01 -08:00
.gitignore added .idea to .gitignore 2020-08-30 09:15:07 +03:00
.travis.yml Increase .travis.yml consistency between repos 2016-09-04 19:52:51 -07:00
CONTRIBUTING.md Update Home master -> Home dev 2015-05-12 11:49:51 -07:00
LinqToDB.Identity.sln working on net core 2.0 2017-11-27 23:33:31 +05:00
MIT-LICENSE.txt v3 release 2020-10-01 11:42:57 +02:00
NuGet.config v3.4.0 2022-12-17 14:20:13 +01:00
NuGetPackageVerifier.json CoreCompat => AspNetCoreCompat 2016-05-24 13:15:38 -07:00
README.md cleanup 2017-11-27 22:21:56 +05:00
Settings.StyleCop Cleanup style cop violations 2014-06-24 14:58:18 -07:00
Tests.snk migrating to Cake build 2017-05-17 15:17:41 +05:00
appveyor.yml version 2018-07-23 11:00:45 +05:00
build.cake ci 2017-11-28 01:35:57 +05:00
build.ps1 migrating to Cake build 2017-05-17 15:17:41 +05:00
build.sh migrating to Cake build 2017-05-17 15:17:41 +05:00
icon64.png v3 release 2020-10-01 11:42:57 +02:00
linq2db.snk migrating to Cake build 2017-05-17 15:17:41 +05:00

README.md

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.