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).
我正在尝试用MySQL作为数据库构建一个MVC 4应用程序,并使用asp.net System.Web.Providers,Entity Framework 5和Code First方法。到目前为止一直都很糟糕!我使用MVC 3 AccountModel使它工作(因为我的mysql连接器还不支持SimpleMembership)。
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.
到目前为止,用户可以创建,但我希望获得有关存储在数据库中的用户的更多信息,例如他们撰写了什么帖子,他们的网站等。为此,我创建了一个存储此信息的UserProfile类。
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?
如何将我的UserProfile类与asp.net auth-stuff相关联,这样只要我的MembershipUser可用,我就能获得额外的用户资料?
Is the reverse possible?
反过来可能吗?
1 个解决方案
#1
1
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
一般来说,对MVC3会员资格,听起来你最好看一个自定义会员提供商。试试这些来寻求帮助
Code Project - Custom Membership Providers
代码项目 - 自定义成员资格提供商
ASP.NET MVC 2 Custom Membership Provider Tutorial
ASP.NET MVC 2自定义成员资格提供程序教程
ASP.Net MVC 3 Custom Membership Provider with Repository Injection
具有存储库注入的ASP.Net MVC 3自定义成员资格提供程序
or maybe the links in this * 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.
如果自定义成员资格似乎超出顶部,您可以尝试创建映射到UserProfile的单独模型,如此和此中所述。
Hope this is helpful.
希望这有用。
#1
1
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
一般来说,对MVC3会员资格,听起来你最好看一个自定义会员提供商。试试这些来寻求帮助
Code Project - Custom Membership Providers
代码项目 - 自定义成员资格提供商
ASP.NET MVC 2 Custom Membership Provider Tutorial
ASP.NET MVC 2自定义成员资格提供程序教程
ASP.Net MVC 3 Custom Membership Provider with Repository Injection
具有存储库注入的ASP.Net MVC 3自定义成员资格提供程序
or maybe the links in this * 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.
如果自定义成员资格似乎超出顶部,您可以尝试创建映射到UserProfile的单独模型,如此和此中所述。
Hope this is helpful.
希望这有用。