kasperhj
kasperhj

Reputation: 10482

Additional user information using EF5, MVC4 (with MVC3 AccountController) and ASP.NET Membership provider

I am trying to build an MVC 4 app with MySQL as database and using asp.net System.Web.Providers, Entity Framework 5 with Code First approach. So far it's been hell! I have made it work using MVC 3 AccountModel (since my mysql connector does not support the SimpleMembership yet).

So far users can be created, but I would like to have a little more information about the users stored in the database, e.g. what post they have authored, their website, etc. For this purpose I have created a UserProfile class that stores this information.

How do I relate my UserProfile class to the asp.net auth-stuff, so I can get the extra user stuff, whenever I have my MembershipUser available?

Is the reverse possible?

Upvotes: 0

Views: 247

Answers (1)

PhantomRick
PhantomRick

Reputation: 52

Without more information it is hard to answer your question.

In general regards to MVC3 Membership, it sounds like you would be best looking at a custom membership provider. Try these for help

Code Project - Custom Membership Providers

ASP.NET MVC 2 Custom Membership Provider Tutorial

ASP.Net MVC 3 Custom Membership Provider with Repository Injection

or maybe the links in this StackOverflow answer

If custom membership seems over the top, you could try creating separate models that map to the UserProfile as mentioned in this and this.

Hope this is helpful.

Upvotes: 1

Related Questions