3

I am planning to use Amazons NoSQL DynamoDB instead of MS SQL Server with newest ASP.NET Identity (OWIN) framework that ships with Visual Studio 2013 but find that its tightly coupled with Microsoft's Entity Framework. I am using WebForm not MVC.

Any suggestion on how to approach this? What classes needs to be overridden? Would DynamoDB even work with EF?

user2655247
  • 35
  • 1
  • 5
  • possible duplicate of [How do I ignore the Identity Framework magic and just use the OWIN auth middleware to get the claims I seek?](http://stackoverflow.com/questions/18885569/how-do-i-ignore-the-identity-framework-magic-and-just-use-the-owin-auth-middlewa) – NotMe Nov 19 '13 at 23:48

1 Answers1

6

The classes in Microsoft.AspNet.Identity.Core have no dependency on Entity Framework and can be used with any persistence store. You will need to provide your own version of the UserStore and possibly the RoleStore (if you need it) classes from Microsoft.AspNet.Identity.EntityFramework though. You don't want to include Microsoft.AspNet.Identity.EntityFramework when using a NoSQL database.

Depending on what you need you will have to implement a number of interfaces on you UserStore. You need to at least implement IUserStore, IUserPasswordStore, IUserSecurityStampStore and IUserLoginStore. The Microsoft provided Entity Framework UserStore implements IUserClaimStore<TUser> and IUserRoleStore<TUser> which you may or may not need to implement depending on what methods of the UserManager you will call.

Assuming that you skip IUserClaimStore and IUserRoleStore, it's 14 methods to implement, most of them pretty straight forward to implement though. These 14 methods is enough to support the parts that are used from the AccountController from the default templates.

I have a project on GitHub where I tried something similar myself, i.e. I implemented a UserStore that use MongoDb instead of EntityFramework for persistence.

Olav Nybø
  • 11,454
  • 8
  • 42
  • 34