diff --git a/src/FilterLists.Data/Seed/Extensions/SeedFilterListsDbContext.cs b/src/FilterLists.Data/Seed/Extensions/SeedFilterListsDbContext.cs index 1ffd67b49..701bfc2c1 100644 --- a/src/FilterLists.Data/Seed/Extensions/SeedFilterListsDbContext.cs +++ b/src/FilterLists.Data/Seed/Extensions/SeedFilterListsDbContext.cs @@ -36,7 +36,7 @@ private static void InsertOnDuplicateKeyUpdate(this DbContext dbCon var properties = GetPropertiesLessValueGeneratedTimestamps(entityType); var values = CreateValues(properties, dataPath); if (values == "") return; - var columns = string.Join(", ", Enumerable.Select(properties, x => x.Name)); + var columns = string.Join(", ", properties.Select(x => x.Name)); var updates = CreateUpdates(properties); var rawSqlString = "INSERT INTO " + entityType.Relational().TableName + " (" + columns + ") VALUES " + values + " ON DUPLICATE KEY UPDATE " + updates; @@ -52,7 +52,7 @@ private static List GetPropertiesLessValueGeneratedTimestamps(IEntity private static string CreateValues(IReadOnlyCollection properties, string dataPath) { - return Enumerable.Select(GetSeedRows(dataPath), row => CreateRowValues(properties, row)).Aggregate("", + return GetSeedRows(dataPath).Select(row => CreateRowValues(properties, row)).Aggregate("", (current, rowValues) => current == "" ? rowValues : current + ", " + rowValues); } @@ -74,7 +74,7 @@ private static string CreateRowValues(IEnumerable proper { return (from property in properties let value = row.GetType().GetProperty(property.Name).GetValue(row) - select FormatDataForMySql(property, value)).Aggregate("", + select FormatDataForMySql(property, value)).Aggregate("", (rowValues, value) => rowValues == "" ? "(" + value : rowValues + ", " + value) + ")"; }