Before Microsoft released MVC 4, I created my project with the good old ASP.NET Membership Provider. After release of MVC 4, Microsoft switched to SimpleMembership by WebMatrix. My project was pretty huge, so I searched for an upgrade path to switch without harming the project. I was in no luck finding a method to switch over, so I followed my own “upgrade path” and decided to share it with the world.
Here is the upgrade path I used:
- Backup everything (Code and SQL)
- Create a new Internet Application [with SimpleMembership]
- Move following folders from old project to new project:
- Controllers [don’t overwrite AccountController.cs]
- Models [don’t overwrite AccountModels.cs]
- Insert connectionString from old project into Web.config
- Run project and create a new user. Then the SimpleMembership SQL tables will be created automatically.
- 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.
- Delete UserProfile entity and UserProfileMap classes, because they come with SimpleMembership’s AccountModels.
- Refactor GUID to integer in the whole project.