Posted on: 12/16/2015 4:32:42 AM | Views : 1257

I'm playing with ASP.NET 5 RC1 and am using Identity 3.0 to provide authentication using usernames/passwords, using the built in ASPNET schema and EF7.
For testing purposes, I'm trying to seed the database with roles and users, using a static method called from Startup.cs. The following code works for adding roles, but not for users. (I couldn't find any sample code for using the new RoleManager and UserManager classes in Identity 3). Am I using the correct method call to UserManager here?

if (!context.Roles.Any(r => r.Name == "Admin")) { var store = new RoleStore<IdentityRole>(context); var manager = new RoleManager<IdentityRole>(store, null, null, null, null, null); var role = new IdentityRole { Name = "Admin" }; manager.CreateAsync(role); } if (!context.Roles.Any(r => ...

Go to the complete details ...