views:

77

answers:

2

I developing a network that uses membership. I have a couple of stories that i have to implement. and i want to use to entity framework with MVC 2 to build this site. asp.net membership system has really really nice features. but is it hard to extend? i dont know.

one of these: i want to give each users to a uniq name that users can use it to "www.somesite.com/someuser" like this. i want to optionally users can generate these unique names from first name and last name(James Hetfield= jameshetfield). so i have to extend my membership table structure. but i dont know that how to save my users first name and last name in my data base to interact with my membership and forms authentication methods. how do i do this?

where i getting confused is: when i change the data on membership tables.. what if there is any field to i have to change with my changes.

+1  A: 

It's easy to extend from a data perspective, just define your own EF Person table and store a ProviderUserKey guid column to serve as a foreign key to the ASP.NET Membership tables.

The larger difficulty occurs when you want to do everything programmatically instead of via the design surface controls (for login, password recovery, etc.). It's all do-able and straightforward once you find the documentation, but you end up doing a lot of googling. You'll need to do this in order to hook the proper events that allow you to create and drop membership and person simultaneously, etc.

All in all, it makes sense to use and extend versus roll your own. There's a lot that's taken care of for you.

Rob
A: 

One quick question, since your concatenated first/last name identifier needs to be unique for URL purposes, why not just make that the username, then add their first and last names to the profile service?

Membership is very convenient and turnkey for the most part. No sense in re-inventing the wheel, especially with the built in objects and support in the Membership and Roles objects. If DB storage is a concern, I'd suggest designing early on to add a new key to the membership table to do joins on. It will really help your performance and space requirements. I recently had to refactor mine and wished I'd done it early on.

Another word of caution is that it is possible to use Membership with MySQL if you have any plans to support that DB, but it is by no means straigh forward.

Laramie
yes. you're right for make unique names approach. i'll consider this. but i want to know is it make sense to implement my own profile provider. because of aspnetsqlprofile provider uses many stored procedure in the sql server, i dont want to fall in those.
berotomanya
I'm not sure I understand your hesitance to use the Sql Profile provider. Adding properties to the Profile Provider involves little more than updating your web.config. See http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx. There's no need to dive into the Stored Procedures unless you really want to. You should be able to read/update data using nothing more than the Profile object in your app. Sorry if I'm misreading your question.
Laramie
thank you.. i just start to work with membership and i didn't know what Profile is (actually still don't) i'll research on it.
berotomanya