tugberkugurlu / AspNet.Identity.RavenDB

Fully asynchronous, new and sweet ASP.NET Identity implementation for RavenDB
MIT License
42 stars 28 forks source link

AspNet.Identity.RavenDB

Fully asynchronous, new and sweet ASP.NET Identity implementation for RavenDB.

Getting Started with Version 2.0.0

Using ASP.NET Identity RavenDB port is pretty straight forward. You can install the AspNet.Identity.RavenDB library through NuGet. For now, the AspNet.Identity.RavenDB package which targets the ASP.NET Identity 2.0.0 release is pre-release. So, be sure to use the -pre switch while getting it through NuGet:

Install-Package AspNet.Identity.RavenDB -Pre

The following code snippet shows the easiest way to stand up the UserManager<TUser> class with RavenUserStore<TUser>:

IDocumentStore documentStore = new DocumentStore
{
    Url = "http://localhost:8080",
    DefaultDatabase = "AspNetIdentity"
}.Initialize();

using (IAsyncDocumentSession session = documentStore.OpenAsyncSession())
{
    session.Advanced.UseOptimisticConcurrency = true;
    RavenUserStore<RavenUser> ravenUserStore = new RavenUserStore<RavenUser>(session);
    UserManager<RavenUser> userManager = new UserManager<RavenUser>(ravenUserStore);

    // UserManager<RavenUser> is ready to use!
}

Couple of things to note here:

Resources for Version 1.0.0