I use codeFirst and I want to run geojson in the database, so there is a table like

/// <summary> /// Класс для ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ΠΎΠ² ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ ΠΌΠΎΠ³ΡƒΡ‚ Π±Ρ‹Ρ‚ΡŒ автоматичСски ΠΈΠΌΠΏΠΎΡ€Ρ‚ΠΈΡ€ΠΎΠ²Π°Π½Ρ‹ /// </summary> [Table("NamedGeoJsonObjects")] public class NamedGeoJsonObject { /// <summary> /// ΠœΠ΅ΠΆΠ΄ΡƒΠ½Π°Ρ€ΠΎΠ΄Π½ΠΎΠ΅ Π½Π°Π·Π²Π°Π½ΠΈΠ΅ сущности /// </summary> [Column("name")] public string Name { get; set; } /// <summary> /// Π›ΠΎΠΊΠ°Π»ΠΈΠ·ΠΎΠ²Π°Π½Π½ΠΎΠ΅ русскоС Π½Π°Π·Π²Π°Π½ΠΈΠ΅ сущности /// </summary> [Column("name_ru")] public string NameRu { get; set; } /// <summary> /// Geojson /// </summary> [Column("geojson")] public FeatureCollection GeoJson { get; set; } } 

When I try to create a migration, I write an error. Is there any option to directly drive GeoJson (or geometry) into the database without using a gasket from string? You can of course do this, of course, but this is exactly what I would like to avoid

  /// <summary> /// Geojson Π»ΠΈΠ½ΠΈΠΈ /// </summary> [Column("geojson")] public string _GeoJson { get; set; } /// <summary> /// Geojson Π»ΠΈΠ½ΠΈΠΈ /// </summary> [NotMapped] public FeatureCollection GeoJson { get { return JsonConvert.DeserializeObject<FeatureCollection>(_GeoJson); } set { _GeoJson = JsonConvert.SerializeObject(value); } } 
  • It depends on the database, some can work with geometry. - RusArt
  • I use postgresql, but the whole point of the entity framework that would be regardless of the type of database used - sag3ll0
  • I somehow tried to implement it on postgresql + postgis + Entity Framework, nothing came of it. Still, the Entity Framework more under MS SQL sharpened. - RusArt

0