I'm new using geography data types and using dapper and I've been searching on the internet for a while but most of the answers aren't for geography type or are outdated. I'm working on a project using google's API to track dynamically but for now it's ok if it just shows various locations i introduce, Any help is appreciated.
Here's the model of my geography table, it's not complete but for now I just need to insert and retrieve data, also my latitude and longitude attributes are null so that I can introduce dynamically any data through a device
[Table("GEOGRAPHY")]
public partial class GEOGRAPHY
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public GEOGRAPHY()
{
DEV_GEO = new HashSet<DEV_GEO>();
RECORDs = new HashSet<RECORD>();
}
[Key]
public int ID_ROUTE { get; set; }
public DbGeography LAT { get; set; }
public DbGeography LONG { get; set; }
[Required]
[StringLength(2)]
public string ISO { get; set; }
[Required]
[StringLength(80)]
public string COUNTRY { get; set; }
[Required]
[StringLength(80)]
public string NICENAME { get; set; }
[StringLength(3)]
public string ISO3 { get; set; }
public short? NUMCODE { get; set; }
public int PHONECODE { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<DEV_GEO> DEV_GEO { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<RECORD> RECORDs { get; set; }
}
Since you mentioned you are using SQL Server, than you can take advantage of specific SQL Server feature support. I wrote an article, along with sample code, on that:
https://medium.com/dapper-net/sql-server-specific-features-2773d894a6ae
The key points are