Didaxis
Didaxis

Reputation: 8746

Add SqlMembership tables using EF Code First

I'm wondering if it's possible to generate the standard MS SQL Server Membership tables (like you would using asp_reg tool) using EF Code First? If so, could you give me the steps necessary to do this?

If not, is my only option to add the tables using asp_reg or the membership scripts to the database created by EF Code First? The problem then would be if I wanted to configure the site to drop and recreate the database on Application_Start, I would lose my membership tables...

Upvotes: 2

Views: 416

Answers (2)

kenwarner
kenwarner

Reputation: 29120

You could use the EF Power Tools to reverse engineer the asp_reg tables into POCOs

Reverse
(source: msdn.com)

Upvotes: 2

Tae-Sung Shin
Tae-Sung Shin

Reputation: 20643

You can have your own table for user, role, and userroles by creating custom membership provider. Have a look at How do I create a custom membership provider for ASP.NET MVC 2?

Upvotes: 1

Related Questions