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

Custom membership provider for the ADO.NET Entity Framework

By , 3 Jan 2013
 

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)

About the Author

Michael Ulmann
Architect Helvetic Solutions
Australia Australia
MCAD, MCPD Web Developer 2.0, MCPD Enterprise Developer 3.5
My company: www.helveticsolutions.com
Hopp Schwiiz Smile | :)

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 2memberNeerajan Lamsal22-Apr-11 0:31 
GeneralRe: My vote of 2memberMichael Ulmann3-Jan-13 11:46 
GeneralRe: My vote of 2memberNeerajan Lamsal4-Mar-13 22:38 
QuestionSmartSoft.pfx password?memberdownatone_77714-Sep-10 9:22 
GeneralMy vote of 3memberGil Fink28-Jul-10 0:35 
GeneralRe: My vote of 3memberMichael Ulmann3-Jan-13 11:46 
QuestionHow does this compare...memberDLester0118-Apr-10 9:25 
QuestionHow can we insert values into FirstName,LastName fields in the DbmemberMember 34735534-Aug-09 11:52 
I have the similar scenario.
But How can we insert values into the FirstName and LastName fields in the Users Table.
Can you give some suggessions?
 
Thanks,
Sudhakar.
GeneralRole and Profile providersmembershapper27-Jul-09 9:18 
GeneralRe: Role and Profile providersmemberMichael Ulmann30-Jul-09 0:40 
GeneralRe: Role and Profile providersmembershapper31-Jul-09 6:04 
GeneralRe: Role and Profile providersmemberMichael Ulmann31-Jul-09 21:43 
GeneralRe: Role and Profile providersmemberMichael Ulmann31-Jul-09 23:47 
GeneralAdd'l ProvidersmemberJeff Bowman24-Jul-09 10:19 
GeneralRe: Add'l ProvidersmemberMichael Ulmann1-Aug-09 14:10 
GeneralRe: Add'l ProvidersmemberJeff Bowman1-Aug-09 19:00 
GeneralHydrating from EFExtensionsmemberjonranes12-Mar-09 23:24 
GeneralRe: Hydrating from EFExtensionsmemberMichael Ulmann1-Aug-09 14:10 
GeneralMy vote of 2memberandrewward16-Feb-09 2:11 
QuestionAre the other providers ready?memberjetset3211-Jan-09 8:49 
AnswerRe: Are the other providers ready?memberMichael Ulmann11-Jan-09 11:34 
GeneralRe: Are the other providers ready?memberjetset3212-Jan-09 8:22 
GeneralRe: Are the other providers ready?memberRoger Jakobsson13-Feb-09 11:01 
GeneralRe: Are the other providers ready?memberMichael Ulmann1-Aug-09 14:10 
GeneralA forgotten thingmemberFatihSever2-Dec-08 15:17 
QuestionRe: A forgotten thingmemberalibaba0698-Dec-08 23:37 
AnswerRe: A forgotten thingmemberFatihSever12-Dec-08 1:09 
GeneralRe: A forgotten thingmemberMichael Ulmann15-Dec-08 17:12 
QuestionAdding an entry in the DBmemberalibaba0691-Dec-08 0:19 
GeneralThanks a lotmemberFatihSever26-Nov-08 11:26 
JokeRe: Thanks a lotmemberalibaba06929-Nov-08 8:32 
AnswerRe: Thanks a lotmemberMichael Ulmann30-Nov-08 11:24 
Generalfor dotnet2.0 not linqmemberhungud9-Nov-08 20:05 
AnswerRe: for dotnet2.0 not linqmemberMichael Ulmann9-Nov-08 22:54 
RantRe: for dotnet2.0 not linqmemberhungud9-Nov-08 23:44 
GeneralRe: for dotnet2.0 not linqmemberAlexRiley14-Feb-09 8:25 
GeneralRe: for dotnet2.0 not linqmemberMichael Ulmann15-Feb-09 11:31 
GeneralMissing providersmemberRoger Jakobsson3-Nov-08 11:10 
AnswerRe: Missing providersmemberMichael Ulmann5-Nov-08 21:54 
GeneralJust another code dump...mvpDave Kreskowiak29-Oct-08 12:53 
GeneralRe: Just another code dump...memberMichael Ulmann29-Oct-08 13:45 
GeneralRe: Just another code dump...mvpDave Kreskowiak30-Oct-08 15:41 

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

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