2

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...

Didaxis
  • 8,486
  • 7
  • 52
  • 89
  • 2
    Sql membership provider comes with more than just tables. Do you need just the tables or all db objects? – frennky Jul 29 '11 at 19:11
  • @frennky -thanks. I guess I wouldn't be exactly sure (whether I need just the tables or the db objects as well). What would be ideal is whatever would just 'jive' with the built-in SqlMembershipProvider. Thanks, and +1 for raising a good point – Didaxis Jul 29 '11 at 20:54

2 Answers2

2

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

Reverse
(source: msdn.com)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
kenwarner
  • 28,650
  • 28
  • 130
  • 173
1

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?

Community
  • 1
  • 1
Tae-Sung Shin
  • 20,215
  • 33
  • 138
  • 240
  • -Thanks, I am familiar with creating custom membership providers. But what I was really looking for was more like what qntmfred suggested, and reverse engineering the membership tables into POCOs because that can easily be made into a reusable component. Thanks anyway. – Didaxis Jul 29 '11 at 20:50