Click here to Skip to main content
11,434,799 members (45,281 online)
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.

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)

Share

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

 
GeneralRe: My vote of 2 Pin
Michael Ulmann15-Nov-14 11:39
memberMichael Ulmann15-Nov-14 11:39 
QuestionSmartSoft.pfx password? Pin
downatone_77714-Sep-10 10:22
memberdownatone_77714-Sep-10 10:22 
AnswerRe: SmartSoft.pfx password? Pin
Michael Ulmann15-Nov-14 11:40
memberMichael Ulmann15-Nov-14 11:40 
GeneralMy vote of 3 Pin
Gil Fink28-Jul-10 1:35
memberGil Fink28-Jul-10 1:35 
GeneralRe: My vote of 3 Pin
Michael Ulmann3-Jan-13 12:46
memberMichael Ulmann3-Jan-13 12:46 
QuestionHow does this compare... Pin
DLester0118-Apr-10 10:25
memberDLester0118-Apr-10 10:25 
AnswerRe: How does this compare... Pin
Michael Ulmann15-Nov-14 11:41
memberMichael Ulmann15-Nov-14 11:41 
QuestionHow can we insert values into FirstName,LastName fields in the Db Pin
Member 34735534-Aug-09 12:52
memberMember 34735534-Aug-09 12:52 
GeneralRole and Profile providers Pin
shapper27-Jul-09 10:18
membershapper27-Jul-09 10:18 
GeneralRe: Role and Profile providers Pin
Michael Ulmann30-Jul-09 1:40
memberMichael Ulmann30-Jul-09 1:40 
GeneralRe: Role and Profile providers Pin
shapper31-Jul-09 7:04
membershapper31-Jul-09 7:04 
GeneralRe: Role and Profile providers Pin
Michael Ulmann31-Jul-09 22:43
memberMichael Ulmann31-Jul-09 22:43 
GeneralRe: Role and Profile providers Pin
Michael Ulmann1-Aug-09 0:47
memberMichael Ulmann1-Aug-09 0:47 
GeneralAdd'l Providers Pin
Jeff Bowman24-Jul-09 11:19
memberJeff Bowman24-Jul-09 11:19 
GeneralRe: Add'l Providers Pin
Michael Ulmann1-Aug-09 15:10
memberMichael Ulmann1-Aug-09 15:10 
GeneralRe: Add'l Providers Pin
Jeff Bowman1-Aug-09 20:00
memberJeff Bowman1-Aug-09 20:00 
GeneralHydrating from EFExtensions Pin
jonranes13-Mar-09 0:24
memberjonranes13-Mar-09 0:24 
GeneralRe: Hydrating from EFExtensions Pin
Michael Ulmann1-Aug-09 15:10
memberMichael Ulmann1-Aug-09 15:10 
The article has been published <a href="http://www.codeproject.com/KB/aspnet/AspNetEFProviders.aspx">here</a>[<a href="http://www.codeproject.com/KB/aspnet/AspNetEFProviders.aspx" target="_blank" title="New Window">^</a>]. Please rate it
GeneralMy vote of 2 Pin
andrewward16-Feb-09 3:11
memberandrewward16-Feb-09 3:11 
QuestionAre the other providers ready? Pin
jetset3211-Jan-09 9:49
memberjetset3211-Jan-09 9:49 
AnswerRe: Are the other providers ready? Pin
Michael Ulmann11-Jan-09 12:34
memberMichael Ulmann11-Jan-09 12:34 
GeneralRe: Are the other providers ready? Pin
jetset3212-Jan-09 9:22
memberjetset3212-Jan-09 9:22 
GeneralRe: Are the other providers ready? Pin
Roger Jakobsson13-Feb-09 12:01
memberRoger Jakobsson13-Feb-09 12:01 
GeneralRe: Are the other providers ready? Pin
Michael Ulmann1-Aug-09 15:10
memberMichael Ulmann1-Aug-09 15:10 
AnswerRe: Are the other providers ready? Pin
Michael Ulmann15-Nov-14 11:43
memberMichael Ulmann15-Nov-14 11:43 
GeneralA forgotten thing Pin
FatihSever2-Dec-08 16:17
memberFatihSever2-Dec-08 16:17 
QuestionRe: A forgotten thing Pin
alibaba0699-Dec-08 0:37
memberalibaba0699-Dec-08 0:37 
AnswerRe: A forgotten thing Pin
FatihSever12-Dec-08 2:09
memberFatihSever12-Dec-08 2:09 
GeneralRe: A forgotten thing Pin
Michael Ulmann15-Dec-08 18:12
memberMichael Ulmann15-Dec-08 18:12 
QuestionAdding an entry in the DB Pin
alibaba0691-Dec-08 1:19
memberalibaba0691-Dec-08 1:19 
GeneralThanks a lot Pin
FatihSever26-Nov-08 12:26
memberFatihSever26-Nov-08 12:26 
JokeRe: Thanks a lot Pin
alibaba06929-Nov-08 9:32
memberalibaba06929-Nov-08 9:32 
AnswerRe: Thanks a lot Pin
Michael Ulmann30-Nov-08 12:24
memberMichael Ulmann30-Nov-08 12:24 
Generalfor dotnet2.0 not linq Pin
hungud9-Nov-08 21:05
memberhungud9-Nov-08 21:05 
AnswerRe: for dotnet2.0 not linq Pin
Michael Ulmann9-Nov-08 23:54
memberMichael Ulmann9-Nov-08 23:54 
RantRe: for dotnet2.0 not linq Pin
hungud10-Nov-08 0:44
memberhungud10-Nov-08 0:44 
GeneralRe: for dotnet2.0 not linq Pin
AlexRiley14-Feb-09 9:25
memberAlexRiley14-Feb-09 9:25 
GeneralRe: for dotnet2.0 not linq Pin
Michael Ulmann15-Feb-09 12:31
memberMichael Ulmann15-Feb-09 12:31 
GeneralMissing providers Pin
Roger Jakobsson3-Nov-08 12:10
memberRoger Jakobsson3-Nov-08 12:10 
AnswerRe: Missing providers Pin
Michael Ulmann5-Nov-08 22:54
memberMichael Ulmann5-Nov-08 22:54 
GeneralJust another code dump... Pin
Dave Kreskowiak29-Oct-08 13:53
mvpDave Kreskowiak29-Oct-08 13:53 
GeneralRe: Just another code dump... Pin
Michael Ulmann29-Oct-08 14:45
memberMichael Ulmann29-Oct-08 14:45 
GeneralRe: Just another code dump... Pin
Dave Kreskowiak30-Oct-08 16:41
mvpDave Kreskowiak30-Oct-08 16:41 

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
Web02 | 2.8.150428.2 | Last Updated 3 Jan 2013
Article Copyright 2008 by Michael Ulmann
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid