public static bool AreWithinRadius(Location a, Location b, double radius)
        {
            double x1 = a.Latitude;
            double y1 = a.Longitude;

            double x2 = b.Latitude;
            double y2 = b.Longitude;

            return Math.Sqrt((y1 - x1) * (y1 - x1) + (y2 - x2) * (y2 - x2)) <= radius;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Locations EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLocations(Location location)
 {
     base.AddObject("Locations", location);
 }
 /// <summary>
 /// Create a new Location object.
 /// </summary>
 /// <param name="locationId">Initial value of the LocationId property.</param>
 /// <param name="latitude">Initial value of the Latitude property.</param>
 /// <param name="longitude">Initial value of the Longitude property.</param>
 /// <param name="address">Initial value of the Address property.</param>
 public static Location CreateLocation(global::System.Int32 locationId, global::System.Double latitude, global::System.Double longitude, global::System.String address)
 {
     Location location = new Location();
     location.LocationId = locationId;
     location.Latitude = latitude;
     location.Longitude = longitude;
     location.Address = address;
     return location;
 }
        private Location CreateLocation(double latitude, double longitude, string name, string address)
        {
            Location location = new Location();
            location.Latitude = latitude;
            location.Longitude = longitude;
            location.Name = name;
            location.Address = address;

            return location;
        }