public static void SeedData(InsightDashboardPnDbContext dbContext) { var configurationSeedData = new InsightDashboardConfigurationSeedData(); foreach (var configurationItem in configurationSeedData.Data) { if (!dbContext.PluginConfigurationValues.Any(x => x.Name == configurationItem.Name)) { var newConfigValue = new PluginConfigurationValue() { Name = configurationItem.Name, Value = configurationItem.Value, CreatedAt = DateTime.UtcNow, Version = 1, WorkflowState = Constants.WorkflowStates.Created, CreatedByUserId = 1 }; dbContext.PluginConfigurationValues.Add(newConfigValue); dbContext.SaveChanges(); } } // Seed plugin permissions var newPermissions = InsightDashboardPermissionsSeedData.Data .Where(p => dbContext.PluginPermissions.All(x => x.ClaimName != p.ClaimName)) .Select(p => new PluginPermission { PermissionName = p.PermissionName, ClaimName = p.ClaimName, CreatedAt = DateTime.UtcNow, Version = 1, WorkflowState = Constants.WorkflowStates.Created, CreatedByUserId = 1 } ); dbContext.PluginPermissions.AddRange(newPermissions); dbContext.SaveChanges(); }