Sunday 15 September 2013

asp.net mvc - Generating admin user from the Seed() method -


I am creating a project where the user can use the admin system just like the CMS (I created in the login Has been with MVC 4 projects) Each site will store data in its SQL CE database. I want to publish the project without any existing DB, and then make the unit framework on the first hit for me.

The problem is that I can not let the account / registration method [AllowAnonymous], so I have an existing account in the "Users" table. I have to be an "superuser" account which is already there when DB becomes, and after that I will log in through this account and create a user account for the customer using CMS.

Is it possible, or do I have to leave the idea and publish the project with the existing DB?

If you have any other smart solutions, then I'm all ears! ;)

PS is the reason that I do not want to publish the site with DB that if I fix some bugs and forget to exclude DB before deployment (already exists) Sites etc.) so I can accidentally overwrite any existing data. I also set it up, so the seed method fills the database with the "starwat" values, so the user starts with a clean slate.

Hope someone has a good idea I tried to search but what I really did not find was what I was looking for.

found the solution here:

/ mikel

No comments:

Post a Comment