Skip to content

carlo-cs/Marten.AspNetIdentity

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NuGet

MartenAspNetIdentity

MartenAspNetIdentity is a Marten DocumentDb implementation of Microsoft.AspNetCore.Identity.

Example usage

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
    services.AddLogging();

    string connectionString = "server=localhost;database=aspnetidentity;uid=aspnetidentity;pwd=aspnetidentity;";

    services.AddIdentity<ApplicationUser, IdentityRole>()
        .AddMartenStores<ApplicationUser, IdentityRole>(connectionString)
        .AddDefaultTokenProviders();

    // more service wireup...
}
  • ApplicationUser is your user class to store.
  • IdentityRole is the role to store.

This will create an IDocumentStore for you, create a database and using the connection string provided, and add it to your services. If you already have an IDocumentStore configured in your DI container, you can use the overload without the connection string, the MartenAspNetIdentity will use this for its managers:

services.AddIdentity<ApplicationUser, IdentityRole>()
        .AddMartenStores<ApplicationUser, IdentityRole>()
        .AddDefaultTokenProviders();

There is a full example in this repository under the Example project

About

Marten implementation of Microsoft.AspNetCore.Identity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 69.5%
  • HTML 30.0%
  • Other 0.5%