3

Does anybody have an example of how to properly reference a user in an ASP.NET membership table (users) in an entity using Entity Framework CodeFirst? I want the resulting table from CodeFirst to reference the existing ASP.NET membership tables. I can elaborate more if required.

2 Answers 2

2

I'm not sure I'm answering your question. But I use the "UserId" field of the "aspnet_Users" table in ForeignKey constraints to reference users.

Sign up to request clarification or add additional context in comments.

2 Comments

So with CodeFirst you put the foreign key in after the database is created?
I'm not sure how you create foreign keys with CodeFirst, sorry. I always design my databases with NaviCat and then update the schema.
1

I recently built a membership provider specifically for code-first development, I based it on the Altairis code-first example but mine has the ability to sit neatly in a separate library away from project code if the need arises.

Check it out at: http://cfmembershipprovider.codeplex.com

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.