Search code examples
asp.net-mvc-4simplemembership

Upgrading to WebMatrix SimpleMembership


I installed MVC 4 when it was in beta, so I didn't get the SimpleMembership library back then. Now I've built a large project using the old MembershipProvider and was wondering how to upgrade from that to WebMatrix SimpleMembership.

I've already created the database schema and EF model and mapping classes. Now I'm wondering how I can upgrade the rest (install required libraries, etc.)

Is there some upgrade path I can follow, just to bypass screwing up my project?


Solution

  • Here is the upgrade path I used:

    1. Backup everything (Code and SQL)
    2. Create a new Internet Application [with SimpleMembership]
    3. Move following folders from old project to new project:
      • Scripts
      • Content
      • Images
      • Controllers [don't overwrite AccountController]
      • Models [don't overwrite AccountModels]
      • Views
    4. Insert connectionString from old project into Web.config
    5. Run project and create a new user. Then the SimpleMembership SQL tables will be created automatically.
    6. Use Entity Framework Power Tools, right click on project and choose Entity Framework -> Reverse Engineer Code First, to generate all EF entity/mapping classes for all SQL tables.
    7. Delete UserProfile entity and UserProfileMap classes, because they come with SimpleMembership's AccountModels.
    8. Refactor GUID to integer in all project.