Ejemplo n.º 1
0
        private static void Main(string[] args)
        {
            using (var context = new SpatialContext())
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
            }

            using (var context = new SpatialContext())
            {
                #region BasicQueryTag
                var myLocation    = new Point(1, 2);
                var nearestPeople = (from f in context.People.TagWith("This is my spatial query!")
                                     orderby f.Location.Distance(myLocation) descending
                                     select f).Take(5).ToList();
                #endregion
            }

            using (var context = new SpatialContext())
            {
                #region ChainedQueryTags
                var results = Limit(GetNearestPeople(context, new Point(1, 2)), 25).ToList();
                #endregion
            }

            using (var context = new SpatialContext())
            {
                #region MultilineQueryTag
                var results = Limit(GetNearestPeople(context, new Point(1, 2)), 25).TagWith(
                    @"This is a multi-line
string").ToList();
                #endregion
            }
        }
Ejemplo n.º 2
0
 private static IQueryable <Person> GetNearestPeople(SpatialContext context, Point myLocation)
 => from f in context.People.TagWith("GetNearestPeople")
 orderby f.Location.Distance(myLocation) descending
 select f;