From 6320ad7d0d8bac04fe665ca580c1b1b6e2c51d2a Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sat, 20 Jan 2018 19:28:37 -0600 Subject: [PATCH] use consistent naming --- .../FilterListsDbContextExtensions.cs | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/FilterLists.Data/FilterListsDbContextExtensions.cs b/src/FilterLists.Data/FilterListsDbContextExtensions.cs index 0b127a812..b01d162fc 100644 --- a/src/FilterLists.Data/FilterListsDbContextExtensions.cs +++ b/src/FilterLists.Data/FilterListsDbContextExtensions.cs @@ -15,39 +15,39 @@ public static class FilterListsDbContextExtensions { private const string SeedDirectory = "Seed"; - public static bool AllMigrationsApplied(this FilterListsDbContext context) + public static bool AllMigrationsApplied(this FilterListsDbContext filterListsDbContext) { - var appliedMigrationIds = context.GetService().GetAppliedMigrations() + var appliedMigrationIds = filterListsDbContext.GetService().GetAppliedMigrations() .Select(m => m.MigrationId); - var allMigrationKeys = context.GetService().Migrations.Select(m => m.Key); + var allMigrationKeys = filterListsDbContext.GetService().Migrations.Select(m => m.Key); return !allMigrationKeys.Except(appliedMigrationIds).Any(); } - public static void EnsureSeeded(this FilterListsDbContext context) + public static void EnsureSeeded(this FilterListsDbContext filterListsDbContext) { - SeedEntities(context); - //InsertOnDuplicateKeyUpdateEntities(context); - SeedJunctions(context); + SeedEntities(filterListsDbContext); + //InsertOnDuplicateKeyUpdateEntities(filterListsDbContext); + SeedJunctions(filterListsDbContext); //TODO: determine if InsertOnDuplicateKeyUpdate() will work for junctions } - private static void SeedEntities(DbContext context) + private static void SeedEntities(DbContext dbContext) { - SeedIfEmpty(context); - SeedIfEmpty(context); - SeedIfEmpty(context); - SeedIfEmpty(context); - SeedIfEmpty(context); - SeedIfEmpty(context); + SeedIfEmpty(dbContext); + SeedIfEmpty(dbContext); + SeedIfEmpty(dbContext); + SeedIfEmpty(dbContext); + SeedIfEmpty(dbContext); + SeedIfEmpty(dbContext); } - private static void SeedJunctions(DbContext context) + private static void SeedJunctions(DbContext dbContext) { - SeedIfEmpty(context); - SeedIfEmpty(context); - SeedIfEmpty(context); - SeedIfEmpty(context); - SeedIfEmpty(context); + SeedIfEmpty(dbContext); + SeedIfEmpty(dbContext); + SeedIfEmpty(dbContext); + SeedIfEmpty(dbContext); + SeedIfEmpty(dbContext); } private static void SeedIfEmpty(DbContext dbContext) where TEntity : class @@ -64,14 +64,14 @@ private static List GetSeedRows() File.ReadAllText(SeedDirectory + Path.DirectorySeparatorChar + typeof(TEntityType).Name + ".json")); } - private static void InsertOnDuplicateKeyUpdateEntities(DbContext context) + private static void InsertOnDuplicateKeyUpdateEntities(DbContext dbContext) { - InsertOnDuplicateKeyUpdate(context); - InsertOnDuplicateKeyUpdate(context); - InsertOnDuplicateKeyUpdate(context); - InsertOnDuplicateKeyUpdate(context); - InsertOnDuplicateKeyUpdate(context); - InsertOnDuplicateKeyUpdate(context); + InsertOnDuplicateKeyUpdate(dbContext); + InsertOnDuplicateKeyUpdate(dbContext); + InsertOnDuplicateKeyUpdate(dbContext); + InsertOnDuplicateKeyUpdate(dbContext); + InsertOnDuplicateKeyUpdate(dbContext); + InsertOnDuplicateKeyUpdate(dbContext); } private static void InsertOnDuplicateKeyUpdate(DbContext dbContext) where TEntityType : class @@ -93,9 +93,9 @@ private static List GetPropertiesLessValueGeneratedTimestamps(IEntity .Where(x => x.ClrType != typeof(DateTime) || x.ValueGenerated == ValueGenerated.Never).ToList(); } - private static string CreateValues(IReadOnlyCollection columnProperties) + private static string CreateValues(IReadOnlyCollection properties) { - return GetSeedRows().Select(row => CreateRowValues(columnProperties, row)).Aggregate("", + return GetSeedRows().Select(row => CreateRowValues(properties, row)).Aggregate("", (current, rowValues) => current == "" ? rowValues : current + ", " + rowValues); }