Click here to Skip to main content
15,860,972 members
Articles / Web Development / XHTML

Custom membership provider for the ADO.NET Entity Framework

Rate me:
Please Sign up or sign in to vote.
4.27/5 (19 votes)
3 Jan 2013CPOL1 min read 155.7K   3.6K   74   48
Custom membership provider implementation for the ADO.NET Entity Framework.

Introduction

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.

Background

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.

History

  • 29/10/2008 - Initial article posted.

License

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


Written By
Architect Swissworx
Australia Australia
MCAD, MCPD Web Developer 2.0, MCPD Enterprise Developer 3.5

My company: Swissworx
My blog: Sitecore Experts

Hopp Schwiiz Smile | :)

Comments and Discussions

 
QuestionUpgrade to ASP .Net Identity Pin
Member 373509320-Dec-13 5:05
Member 373509320-Dec-13 5:05 
AnswerRe: Upgrade to ASP .Net Identity Pin
Michael Ulmann15-Nov-14 10:39
Michael Ulmann15-Nov-14 10:39 
GeneralMy vote of 2 Pin
Neerajan Lamsal22-Apr-11 0:31
Neerajan Lamsal22-Apr-11 0:31 
GeneralRe: My vote of 2 Pin
Michael Ulmann3-Jan-13 11:46
Michael Ulmann3-Jan-13 11:46 
GeneralRe: My vote of 2 Pin
Neerajan Lamsal4-Mar-13 22:38
Neerajan Lamsal4-Mar-13 22:38 
GeneralRe: My vote of 2 Pin
Michael Ulmann15-Nov-14 10:39
Michael Ulmann15-Nov-14 10:39 
QuestionSmartSoft.pfx password? Pin
downatone_77714-Sep-10 9:22
downatone_77714-Sep-10 9:22 
AnswerRe: SmartSoft.pfx password? Pin
Michael Ulmann15-Nov-14 10:40
Michael Ulmann15-Nov-14 10:40 
GeneralMy vote of 3 Pin
Gil Fink28-Jul-10 0:35
Gil Fink28-Jul-10 0:35 
GeneralRe: My vote of 3 Pin
Michael Ulmann3-Jan-13 11:46
Michael Ulmann3-Jan-13 11:46 
QuestionHow does this compare... Pin
DLester0118-Apr-10 9:25
DLester0118-Apr-10 9:25 
AnswerRe: How does this compare... Pin
Michael Ulmann15-Nov-14 10:41
Michael Ulmann15-Nov-14 10:41 
QuestionHow can we insert values into FirstName,LastName fields in the Db Pin
Member 34735534-Aug-09 11:52
Member 34735534-Aug-09 11:52 
GeneralRole and Profile providers Pin
shapper27-Jul-09 9:18
shapper27-Jul-09 9:18 
GeneralRe: Role and Profile providers Pin
Michael Ulmann30-Jul-09 0:40
Michael Ulmann30-Jul-09 0:40 
GeneralRe: Role and Profile providers Pin
shapper31-Jul-09 6:04
shapper31-Jul-09 6:04 
GeneralRe: Role and Profile providers Pin
Michael Ulmann31-Jul-09 21:43
Michael Ulmann31-Jul-09 21:43 
GeneralRe: Role and Profile providers Pin
Michael Ulmann31-Jul-09 23:47
Michael Ulmann31-Jul-09 23:47 
GeneralAdd'l Providers Pin
Jeff Bowman24-Jul-09 10:19
professionalJeff Bowman24-Jul-09 10:19 
GeneralRe: Add'l Providers Pin
Michael Ulmann1-Aug-09 14:10
Michael Ulmann1-Aug-09 14:10 
GeneralRe: Add'l Providers Pin
Jeff Bowman1-Aug-09 19:00
professionalJeff Bowman1-Aug-09 19:00 
GeneralHydrating from EFExtensions Pin
jonranes12-Mar-09 23:24
jonranes12-Mar-09 23:24 
GeneralRe: Hydrating from EFExtensions Pin
Michael Ulmann1-Aug-09 14:10
Michael Ulmann1-Aug-09 14:10 
GeneralMy vote of 2 Pin
andrewward16-Feb-09 2:11
andrewward16-Feb-09 2:11 
QuestionAre the other providers ready? Pin
jetset3211-Jan-09 8:49
jetset3211-Jan-09 8:49 
Hi,

This is really good stuff, how much longer have we got until the rest are ready?

Thanks again,

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

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