In VS2013 They taken the Website Administration Tool that you used to be able to set up Roles and membership. I'm trying to add an "Admin" role to my site and add my user name to it but everything I've tried has not worked.
var roleManager = new RoleManager(new RoleStore(context)); roleManager.Create(new IdentityRole("Administrator"));
var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(context));
var user = new ApplicationUser { UserName = "admin" };
userManager.Create(user, "admin321");
userManager.AddToRole(user.Id, "Administrator");
Running this in my MVC5 web app. gives me the following error;
An exception of type 'System.InvalidOperationException' occurred in mscorlib.dll but was not handled in user code
Additional information: The entity type IdentityRole is not part of the model for the current context.
the error is produced on the; roleManager.Create(new IdentityRole("Administrator"));