コード例 #1
0
 public static void ClearDatabase(this RivaUsersDbContext dbContext)
 {
     RemoveCities(dbContext);
     RemoveUsers(dbContext);
     RemoveDomainEvents(dbContext);
     dbContext.SaveChanges();
 }
コード例 #2
0
        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);
        }