Click here to Skip to main content
11,806,575 members (68,685 online)
Click here to Skip to main content

Custom membership provider for the ADO.NET Entity Framework

, 3 Jan 2013 CPOL 102.9K 3.4K 73
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 | :)

You may also be interested in...

Comments and Discussions

QuestionAdding an entry in the DB Pin
alibaba0691-Dec-08 0:19
memberalibaba0691-Dec-08 0:19 
Hi. I would like to ask you a Question.

I don't know much about Provider Model Design Patterns. I would like to use them, because they are well known. I was doing some examples for integrate it in my application in ADO.NET. And I have a doubt.

Is it possible to use providers if in my data base I have other entries (such us telephone number) that they are not specified in the MemberShip Provider?

Then If I add it on my implementation of EFMemberShipProvider it won't work with another Provider like SqlMemberShipProvider.

And what about if I don't use one, like userName because I consider the email as identifier.

Can I still use a Provider Model Design?


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