Click here to Skip to main content
Click here to Skip to main content

Custom membership provider for the ADO.NET Entity Framework

, 3 Jan 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
Custom membership provider implementation for the ADO.NET Entity Framework.


Note: This article has been superseded by the following code project article. 

This article describes the implementation of a custom membership provider for the ADO.NET entity framework. The code presented in this article fully complies with Microsoft's provider model design pattern. It also leverages the LINQ to Entities feature introduced with framework 3.5.


It is required to have a basic understanding of the ADO.NET Entity Framework and the ASP.NET membership provider model in order to successfully integrate the presented solution.

Using the code

To configure the attached sample, the following steps have to be taken into account:

  1. Create a database (e.g., EFDataModel).
  2. Run the CreateUserTable.sql script located in the DatabaseScripts solution folder.
  3. Modify the connection string for the Entity Framework in the App.config file of the SmartSoft.EFMembershipProvider.DataLayer project.
  4. Modify connection string for the Entity Framework in the Web.config file of the Web application.

If you want to integrate the custom membership provider into your existing application, you might have to replace the object context EFDataModelEntities within the membership provider class according to your entity model.

Depending on your data model, the method DeleteUser within the membership provider class has to be extended from line 698 onwards in order to delete/mark all user related data.


  • 29/10/2008 - Initial article posted.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Michael Ulmann
Architect Helvetic Solutions
Australia Australia
MCAD, MCPD Web Developer 2.0, MCPD Enterprise Developer 3.5

My company: Helvetic Solutions
My blog: Sitecore Experts

Hopp Schwiiz Smile | :)

Comments and Discussions

QuestionUpgrade to ASP .Net Identity PinmemberMember 373509320-Dec-13 6:05 
AnswerRe: Upgrade to ASP .Net Identity PinmemberMichael Ulmann15-Nov-14 11:39 
GeneralMy vote of 2 PinmemberNeerajan Lamsal22-Apr-11 1:31 
GeneralRe: My vote of 2 PinmemberMichael Ulmann3-Jan-13 12:46 
GeneralRe: My vote of 2 PinmemberNeerajan Lamsal4-Mar-13 23:38 
GeneralRe: My vote of 2 PinmemberMichael Ulmann15-Nov-14 11:39 
QuestionSmartSoft.pfx password? Pinmemberdownatone_77714-Sep-10 10:22 
AnswerRe: SmartSoft.pfx password? PinmemberMichael Ulmann15-Nov-14 11:40 
GeneralMy vote of 3 PinmemberGil Fink28-Jul-10 1:35 
GeneralRe: My vote of 3 PinmemberMichael Ulmann3-Jan-13 12:46 
QuestionHow does this compare... PinmemberDLester0118-Apr-10 10:25 
AnswerRe: How does this compare... PinmemberMichael Ulmann15-Nov-14 11:41 
QuestionHow can we insert values into FirstName,LastName fields in the Db PinmemberMember 34735534-Aug-09 12:52 
GeneralRole and Profile providers Pinmembershapper27-Jul-09 10:18 
GeneralRe: Role and Profile providers PinmemberMichael Ulmann30-Jul-09 1:40 
GeneralRe: Role and Profile providers Pinmembershapper31-Jul-09 7:04 
GeneralRe: Role and Profile providers PinmemberMichael Ulmann31-Jul-09 22:43 
GeneralRe: Role and Profile providers PinmemberMichael Ulmann1-Aug-09 0:47 
GeneralAdd'l Providers PinmemberJeff Bowman24-Jul-09 11:19 
Hi Michael, any news on the other providers?

If they're still in beta, are you willing to send the code as is?

GeneralRe: Add'l Providers PinmemberMichael Ulmann1-Aug-09 15:10 
GeneralRe: Add'l Providers PinmemberJeff Bowman1-Aug-09 20:00 
GeneralHydrating from EFExtensions Pinmemberjonranes13-Mar-09 0:24 
GeneralRe: Hydrating from EFExtensions PinmemberMichael Ulmann1-Aug-09 15:10 
GeneralMy vote of 2 Pinmemberandrewward16-Feb-09 3:11 
QuestionAre the other providers ready? Pinmemberjetset3211-Jan-09 9:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150414.1 | Last Updated 3 Jan 2013
Article Copyright 2008 by Michael Ulmann
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid