MS SQl Server引进两种特殊的数据类型geography and geometry

EntityFramework 学习 一   Spatial Data type support in Entity Framework 5.0

public partial class Course
{
    public Course()
    {
        this.Students = new HashSet<Student>();
    }
    
    public int CourseId { get; set; }
    public string CourseName { get; set; }
    public Nullable<int> TeacherId { get; set; }
    public System.Data.Spatial.DbGeography Location { get; set; }
    
    public virtual Teacher Teacher { get; set; }
    public virtual ICollection<Student> Students { get; set; }
}
     

 

 

using (var ctx = new SchoolDBEntities())
{
    ctx.Courses.Add(new Course() { CourseName = "New Course", 
                Location = DbGeography.FromText("POINT(-122.360 47.656)") });

    ctx.SaveChanges();
}
        

 

相关文章:

  • 2021-12-17
  • 2021-08-12
  • 2021-06-07
  • 2021-05-29
  • 2021-05-18
  • 2021-06-19
  • 2021-07-09
  • 2021-12-30
猜你喜欢
  • 2022-02-01
  • 2021-12-26
  • 2021-11-27
  • 2021-11-16
  • 2022-02-18
  • 2021-04-27
  • 2021-09-10
相关资源
相似解决方案