diff options
| author | ivar <i@oiee.no> | 2025-10-20 00:26:34 +0200 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2025-10-20 00:26:34 +0200 |
| commit | a1f0518d0cd123a791adde64f4f11bd8e44276c7 (patch) | |
| tree | 675a7dff8262eea877ec800ff1efe9b92f5d7e7d /api/WhatApi/Seed.cs | |
| download | what-a1f0518d0cd123a791adde64f4f11bd8e44276c7.tar.xz what-a1f0518d0cd123a791adde64f4f11bd8e44276c7.zip | |
Initial commit
Diffstat (limited to 'api/WhatApi/Seed.cs')
| -rw-r--r-- | api/WhatApi/Seed.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/api/WhatApi/Seed.cs b/api/WhatApi/Seed.cs new file mode 100644 index 0000000..c3127cc --- /dev/null +++ b/api/WhatApi/Seed.cs @@ -0,0 +1,24 @@ +using Bogus; +using Bogus.Locations; +using NetTopologySuite.Geometries; +using WhatApi.Tables; + +namespace WhatApi; + +public partial class Program +{ + private static void Seed(Database db) { + if (db.Places.Any() || true) return; + var places = new List<Place>(); + var location = new Faker().Location(); + for (var i = 0; i < 1000; i++) { + var point = location.AreaCircle(59.91838, 10.73861, 30000); + places.Add(new Place() { + Location = new Point(new Coordinate(point.Longitude, point.Latitude)), + ContentId = new Guid("1337710a-8cdb-4d50-815f-772c0e9f1482") + }); + } + db.Places.AddRange(places); + db.SaveChanges(); + } +}
\ No newline at end of file |
