Click here to Skip to main content
15,860,861 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

 
QuestionAre the other providers ready? Pin
jetset3211-Jan-09 8:49
jetset3211-Jan-09 8:49 
AnswerRe: Are the other providers ready? Pin
Michael Ulmann11-Jan-09 11:34
Michael Ulmann11-Jan-09 11:34 
GeneralRe: Are the other providers ready? Pin
jetset3212-Jan-09 8:22
jetset3212-Jan-09 8:22 
GeneralRe: Are the other providers ready? Pin
Roger Jakobsson13-Feb-09 11:01
professionalRoger Jakobsson13-Feb-09 11:01 
GeneralRe: Are the other providers ready? Pin
Michael Ulmann1-Aug-09 14:10
Michael Ulmann1-Aug-09 14:10 
AnswerRe: Are the other providers ready? Pin
Michael Ulmann15-Nov-14 10:43
Michael Ulmann15-Nov-14 10:43 
GeneralA forgotten thing Pin
FatihSever2-Dec-08 15:17
FatihSever2-Dec-08 15:17 
QuestionRe: A forgotten thing Pin
alibaba0698-Dec-08 23:37
alibaba0698-Dec-08 23:37 
Can your property IsLockedOut be null?

Don't you get this error?

Operator '&&' cannot be applied to operands of type 'bool' and 'bool?'

Thanks!!
AnswerRe: A forgotten thing Pin
FatihSever12-Dec-08 1:09
FatihSever12-Dec-08 1:09 
GeneralRe: A forgotten thing Pin
Michael Ulmann15-Dec-08 17:12
Michael Ulmann15-Dec-08 17:12 
QuestionAdding an entry in the DB Pin
alibaba0691-Dec-08 0:19
alibaba0691-Dec-08 0:19 
GeneralThanks a lot Pin
FatihSever26-Nov-08 11:26
FatihSever26-Nov-08 11:26 
JokeRe: Thanks a lot Pin
alibaba06929-Nov-08 8:32
alibaba06929-Nov-08 8:32 
AnswerRe: Thanks a lot Pin
Michael Ulmann30-Nov-08 11:24
Michael Ulmann30-Nov-08 11:24 
Generalfor dotnet2.0 not linq Pin
hungud9-Nov-08 20:05
hungud9-Nov-08 20:05 
AnswerRe: for dotnet2.0 not linq Pin
Michael Ulmann9-Nov-08 22:54
Michael Ulmann9-Nov-08 22:54 
RantRe: for dotnet2.0 not linq Pin
hungud9-Nov-08 23:44
hungud9-Nov-08 23:44 
GeneralRe: for dotnet2.0 not linq Pin
AlexRiley14-Feb-09 8:25
AlexRiley14-Feb-09 8:25 
GeneralRe: for dotnet2.0 not linq Pin
Michael Ulmann15-Feb-09 11:31
Michael Ulmann15-Feb-09 11:31 
GeneralMissing providers Pin
Roger Jakobsson3-Nov-08 11:10
professionalRoger Jakobsson3-Nov-08 11:10 
AnswerRe: Missing providers Pin
Michael Ulmann5-Nov-08 21:54
Michael Ulmann5-Nov-08 21:54 
GeneralJust another code dump... Pin
Dave Kreskowiak29-Oct-08 12:53
mveDave Kreskowiak29-Oct-08 12:53 
GeneralRe: Just another code dump... Pin
Michael Ulmann29-Oct-08 13:45
Michael Ulmann29-Oct-08 13:45 
GeneralRe: Just another code dump... Pin
Dave Kreskowiak30-Oct-08 15:41
mveDave Kreskowiak30-Oct-08 15:41 

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.