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); } }