public static void ClearDatabase(this RivaUsersDbContext dbContext) { RemoveCities(dbContext); RemoveUsers(dbContext); RemoveDomainEvents(dbContext); dbContext.SaveChanges(); }
private City InsertCity() { var city = new City(Guid.NewGuid(), new List <Guid> { Guid.NewGuid() }); var cityEntity = new CityEntity { Id = city.Id, CityDistricts = city.CityDistricts.Select(x => new CityDistrictEntity { Id = x, CityId = city.Id }).ToList() }; _context.Cities.Add(cityEntity); _context.SaveChanges(); return(city); }