public void SeedEverything(GhostDriveDbContext context) { context.Database.EnsureCreated(); if (context.Users.Any()) { return; } SeedUsers(context); }
public void SeedUsers(GhostDriveDbContext context) { var users = Enum.GetValues(typeof(UserRole)).Cast <UserRole>().Select(role => new User { Login = role.ToString().ToLower(), Password = "******", PasswordSalt = "Od+ES7bdQXfOSAx9Dc0ZooSk/iDv1ATZdp6CqilHlgXCDxMyF31xYBmY7pAT+JW5HzlIkzAJDPt8tQhqMYdObrwVk0RjENhCCPTJgKzELrt91w4UHPcvXD45Lr9GP2OQFy8fUvgxkwREM4XqTVsUQx0jbSj0hcvyPl9VvpX8AuOc5Mw2Sz3u99BdmaIhabeHBTvA8q5TuT7EsXL9M0jfSHYFJd7PfjyxF8arD19x33CiR4t8y7SrFZQ/uliMPm0sVnxcHwcgMQfYOZeKOPJSnJtal/sc8Opu6H8jmFlMFCUWUP+NE5NW4GapXvG0Wrfg9uYvvakXjhJcPe8t98//cg==", Role = role, RegistrationDate = DateTime.Now }); context.Users.AddRange(users); context.SaveChanges(); }
public static void Initialize(GhostDriveDbContext context) { var initializer = new GhostDriveInitializer(); initializer.SeedEverything(context); }