public async Task Run() { _dbContext.Dogs.Add(new Dog() { Name = "Lulu", Sex = SexEnum.Female }); await _dbContext.SaveChangesAsync(); var dogs = _dbContext.Dogs.ToList(); }
private async Task AddTestData() { var point = new NetTopologySuite.Geometries.Point(new Coordinate(10, 10)); point.SRID = srid; _dbContext.Cities.Add(new City() { CityName = "ChengDu", Location = point }); var line = new NetTopologySuite.Geometries.LineString(new Coordinate[] { new Coordinate(0, 0), new Coordinate(10, 0), new Coordinate(10, 10), new Coordinate(0, 10) }); line.SRID = srid; _dbContext.Roads.Add(new Road() { RoadName = "Road Name 1", Line = line }); var border = new NetTopologySuite.Geometries.Polygon(new LinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(10, 0), new Coordinate(10, 10), new Coordinate(0, 10), new Coordinate(0, 0) })); border.SRID = srid; _dbContext.Countries.Add(new Country() { CountryName = "China", Border = border }); await _dbContext.SaveChangesAsync(); }