Asp.Net Membership - Providers in Entity Framework 4

I have a site using ASP.NET membership, Entity Framework 4 and MS SQL 2008 for DB.

I would like to know if using ASP.NET membership will interact with the database using Entity Framework?

Thank you for your help!

+7
asp.net-membership
source share
3 answers

If you need a custom membership provider, you just need to create a class that inherits the abstract class MembershipProvider. Then you will need to implement abstract methods like ValidateUser, UpdateUser, GetUser, etc. You can use EntityFramework when implementing your custom membership provider methods.

The following documents implement a custom membership provider using odbc. You can use your EntityModel instead of odbc.

http://msdn.microsoft.com/en-us/library/44w5aswa.aspx

http://msdn.microsoft.com/en-us/library/6tc47t75.aspx

+8
source share

Musa's response to remove the negative. There is no mention of a custom membership provider, but this does not mean that this is not an answer.

He sees on the right, there is no specific EF4 vendor that comes with the framework, but you can create your own.

This actually consolidates the problem area, because you can CLEAN the users ’connection with the rest of the entity’s objects, and not consider membership as a separate black box that you have to deal with.

The way to do this is to inherit from the MembershipProvider and implement abstract methods.

Once you do this, you can do whatever you want with users, etc., instead of living in fear of breaking the SQLMembership tables and stored procedures that you get by default - which I don't like to use, because they are ugly.

I just did this using my own EF4 model, with my own user implementation, etc. I used the sample code that came with this video - http://www.asp.net/general/videos/how-do-i-create-a-custom-membership-provider . BTW, if you use this sample code as is, watch out for a few typos in stored procedure names!

+10
source share

No, SqlMembership, as well as other providers in the Sql stack, use directly stored procedures.

You can, if you want, create an EF conceptual model on top of your aspnet_db database if you want to learn or interact with it.

But let me strongly recommend that you consider it as read only if you do not know exactly what you want to update or delete.

+6
source share

All Articles