A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/linq2db/LinqToDB.Identity below:

linq2db/LinqToDB.Identity: ASP.NET Core Identity provider that uses LinqToDB.

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:

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);

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4