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:
- Create a database (e.g., EFDataModel).
- Run the CreateUserTable.sql script located in the DatabaseScripts solution folder.
- Modify the connection string for the Entity Framework in the App.config file of the SmartSoft.EFMembershipProvider.DataLayer project.
- 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.