Membership in NHibernate and ASP.NET

I am using ASP.NET MVC 3 for an application that uses a large number of users or users and roles.

To create a user and assign roles, I use a standard process through ASP.NET membership.

Throughout the application, I use NHibernate for basic data access, except where the default implementations are MembershipProvider and RoleProvider (inside the AccountController that delegates calls to these implementations).

I would like to use NHibernate to be able to read / edit / modify values ​​in those tables that are managed by ASP.NET membership.

I found two solutions:

  • Write a custom NHibernate implementation for MembershipProvider and RoleProvider (or even use this . This is the hardest way.

  • Match only the tables (as described here ) and then use NHibernate directly (although any default actions from AccountController will still be handled by default providers).

Any suggestions / recommendations?

+5
source share
1 answer

I used the custom provider you contact with with pretty good success. I made several changes to it, so that he will use one session for his life.

ASP.net, , - , ( , SP ). MSSQL Postgres , MySQL.

+3

All Articles