Guidelines to integrate RavenDB with ASP.NET MVC application
Create a new ASP.NET MVC project with the Authentication type set as Individual User Accounts
File -> New -> Project -> Web -> ASP.NET Web Application
Replace Entity Framework with RavenDB as storage provider using NuGet Package Manager
Uninstall-Package Microsoft.AspNet.Identity.EntityFramework
Uninstall-Package EntityFramework
Install-Package CreativeColon.Raven.Identity
Note: You might need to restart Visual Studio for Entity Framework to be completely removed.
Delete these files from the project as they're not required anymore
App_Start/IdentityConfig.cs
Models/IdentityModels.cs
Add these namespaces to the given files
-
Namespaces
using CreativeColon.Raven.Identity.Domain;
using CreativeColon.Raven.Identity.Models;
-
Files
App_Start/Startup.Auth.cs
Controllers/AccountController.cs
Controllers/ManageController.cs
Add Connection String for RavenDB and name it as RavenConnection to avoid any effort
<add name="RavenConnection" connectionString="Url=http://localhost:8080;Database=IdentityDB" />
Do this only if you've NOT named your Connection String as RavenConnection
<add name="MyNoSqlDB" connectionString="Url=http://localhost:8080;Database=IdentityDB" />
Open App_Start/Startup.Auth.cs
and replace Line 1 with Line 2
1. app.CreatePerOwinContext(ApplicationDbContext.Create);
2. app.CreatePerOwinContext(() => { return ApplicationDbContext.Create("MyNoSqlDB"); });
For enabling Email Verification and Forgot Password functionalities
Add SMTP details in web.config file
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="SenderEmailAddress">
<network host="SMTPHost" port="587" userName="Username" password="Password" enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
Visit MVC Template with Raven Identity which has all the changes required for this integration