MVC3 Entity Framework Using Default Relationships

I want to create a relationship between the user table (s) and the default aspnet tables associated with users.

I use code-first, so for most FK relationships I just did

public ModelName ModelName { get; set; }

In doing so, EF will automatically create FK relationships. Very easy.

Which is confusing the most efficient way to connect to an aspnet user / membership table. Create a new model. Users who act as an interface so that I can implement user user code?

Is there a better way to do this that fits well with EF best practices? I just want to associate a user with a website table / model so that EF can accomplish its task.

+3
source share
2 answers

This has several prerequisites:

  • ASP.NET tables must be in the same database as your own tables
  • The previous precondition means that you must either create your database and tables manually (without automatically generating code), or you must use some kind of custom initializer that will add non-displayable ASP.NET tables as part of the database rest

, ASP.NET, ASP.NET . , ASP.NET , , , MembershipUser , EF. , , , ASP.NET.

+2

" , , ?"

, , . , , - .

, "AppUser", "UserID" aspnet_Membership. , "AppUser" , MS ( ). MS MVC, - DLL MvcMembership.

https://github.com/TroyGoode/MembershipStarterKit

, !

+3

All Articles