Note that there are some explanatory texts on larger screens.

plurals
  1. POA Custom Membership Provider *Without* a Database?
    text
    copied!<p>I've been looking around various SO questions, blog posts, and so forth regarding the changes to membership providers in MVC 4. While I like many of the changes and the simplification of things (particularly the out-of-the-box external login support), I'm as yet unable to find one seemingly-simple thing...</p> <p>How can I override the membership/role provider with a custom one that uses another data source?</p> <p>I don't want to replace <code>WebSecurity</code> or anything that drastic, since it handles all of the things I want it to handle. (Cookie management, for example.) I don't want to do anything that will break the existing support for external login providers, as my application uses those in conjunction with local logins. All I'm looking to do is interject between the membership system and the database behind it and customize that data fetching.</p> <p>The tables that it creates by default are:</p> <ul> <li>UserProfile</li> <li>webpages_Membership</li> <li>webpages_OAuthMembership</li> <li>webpages_Roles</li> <li>webpages_UsersInRoles</li> </ul> <p>And while that works, I have cause to abstract this behind some custom objects and break the coupling between the application and the database. (Basically, I have some custom domain models full of business logic which should handle all of this, and I want the membership/role system to use those models instead of the database. Those models might get their persisted data from a database, they might not. That shouldn't matter.)</p> <p>Most of the references I find for customization claim that it's easy to do, all I have to do is modify the <code>UserProfile</code> model, include my new custom fields in various calls, and update the call to <code>InitializeDatabaseConnection</code> to point it to my database schema.</p> <p>But I'm not using a database. (Or, more specifically, as far as the application layer is concerned there's no such thing as a database. Only my domain models.) So that easy customization doesn't really change anything.</p> <p>Is there a way to interject between the membership system and the database so I can make a custom data provider for the existing membership provider?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload