Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET Identity DB Seed
    primarykey
    data
    text
    <p>I am trying to set up some seed data for my MVC 5 Web Application, but it doesn't seem to be creating any for IdentityUser. When I check the App_Data folder it's empty (Show All files is enabled)</p> <p>Here is my WebAppDatabaseInitializer.cs</p> <pre><code>public class WebAppDatabaseInitializer : DropCreateDatabaseIfModelChanges&lt;WebAppDbContext&gt; { protected override void Seed(WebAppDbContext context) { var UserManager = new UserManager&lt;ApplicationUser&gt;(new UserStore&lt;ApplicationUser&gt;(context)); var RoleManager = new RoleManager&lt;IdentityRole&gt;(new RoleStore&lt;IdentityRole&gt;(context)); string name = "Admin"; string password = "123456"; string test = "test"; //Create Role Test and User Test RoleManager.Create(new IdentityRole(test)); UserManager.Create(new ApplicationUser() { UserName = test }); //Create Role Admin if it does not exist if (!RoleManager.RoleExists(name)) { var roleresult = RoleManager.Create(new IdentityRole(name)); } //Create User=Admin with password=123456 var user = new ApplicationUser(); user.UserName = name; var adminresult = UserManager.Create(user, password); //Add User Admin to Role Admin if (adminresult.Succeeded) { var result = UserManager.AddToRole(user.Id, name); } base.Seed(context); } } </code></pre> <p>and my Global.asax.cs</p> <pre><code>public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Database.SetInitializer(new WebAppDatabaseInitializer()); } } </code></pre> <p>any ideas what might be going wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload