/// <summary> /// Initializes the database with default data to support other tables. /// </summary> /// <param name="context"></param> /// <returns></returns> public static PimsContext SeedDatabase(this PimsContext context) { context.AddRange(EntityHelper.CreateDefaultPropertyClassifications()); context.AddRange(EntityHelper.CreateDefaultProvinces()); context.AddRange(EntityHelper.CreateDefaultAdministrativeAreas()); context.AddRange(EntityHelper.CreateDefaultRoles()); context.AddRange(EntityHelper.CreateDefaultBuildingPredominateUses()); context.AddRange(EntityHelper.CreateDefaultBuildingConstructionTypes()); context.AddRange(EntityHelper.CreateDefaultBuildingOccupantTypes()); context.AddRange(EntityHelper.CreateDefaultAgencies()); context.AddRange(EntityHelper.CreateDefaultTierLevels()); context.AddRange(EntityHelper.CreateDefaultProjectRisks()); context.SaveChanges(); return(context); }
/// <summary> /// Initialize the PimsContext with the specified data in 'entities'. /// Initializes the database with default data to support other tables. /// </summary> /// <param name="helper"></param> /// <param name="dbName"></param> /// <param name="user"></param> /// <returns></returns> public static PimsContext InitializeDatabase(this TestHelper helper, string dbName, ClaimsPrincipal user) { var context = helper.CreatePimsContext(dbName, user, true); context.AddRange(EntityHelper.CreateDefaultPropertyClassifications()); context.AddRange(EntityHelper.CreateDefaultProvinces()); context.AddRange(EntityHelper.CreateDefaultCities()); context.AddRange(EntityHelper.CreateDefaultRoles()); context.AddRange(EntityHelper.CreateDefaultBuildingPredominateUses()); context.AddRange(EntityHelper.CreateDefaultBuildingConstructionTypes()); context.AddRange(EntityHelper.CreateDefaultBuildingOccupantTypes()); context.AddRange(EntityHelper.CreateDefaultAgencies()); context.AddRange(EntityHelper.CreateDefaultTierLevels()); context.AddRange(EntityHelper.CreateDefaultProjectRisks()); context.SaveChanges(); return(context); }