Skip to content

MyMojo.AspNet.Identity.MongoDb is a MongoDb backend provider that is a nearly in place replacement for Microsoft.AspNet.Identity.EntityFramework

License

Notifications You must be signed in to change notification settings

wallaceiam/MyMojo.AspNet.Identity.MongoDb

Repository files navigation

MyMojo.AspNet.Identity.MongoDb

ASP.NET MVC 5 shipped with a new Identity system (in the Microsoft.AspNet.Identity.Core package) in order to support both local login and remote logins via OpenID/OAuth, but only ships with an Entity Framework provider (Microsoft.AspNet.Identity.EntityFramework).

MyMojo.AspNet.Identity.MongoDb is a MongoDB backend provider that is a nearly in place replacement for the EF version.

Quick Start

using MyMojo.AspNet.Identity.MongoDb

Replace

 services.AddDbContext<ApplicationDbContext>(options =>
               options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

with

services.AddMongoDbContext<IMongoDatabase>(
                connectionString: Configuration.GetConnectionString("MongoDbConnection"));

And Replace

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

with

services.AddIdentity<ApplicationUser, IdentityRole>()
                .AddMongoDbStores<IMongoDatabase>("users", "roles")
                .AddDefaultTokenProviders();

Please raise any Issues.

Thanks and enjoy

About

MyMojo.AspNet.Identity.MongoDb is a MongoDb backend provider that is a nearly in place replacement for Microsoft.AspNet.Identity.EntityFramework

Resources

License

Stars

Watchers

Forks

Packages

No packages published