예제 #1
0
            public Location New(string address)
            {
                if (string.IsNullOrWhiteSpace(address))
                {
                    throw new ArgumentException(
                              "wholeAddress cannot be null, empty, or whitespace.",
                              "wholeAddress");
                }

                var coordinates = _geocoder.GeoCode(address);

                // This is a relatively simple implementation, but we
                // could get fancier here.  For example we might pass
                // in some constraint that requires the address be
                // geocode -able with a certain precision (e.g., when
                // a postal code centroid isn't good enough).

                return(new Location
                {
                    Address = address,
                    Coordinates = coordinates,
                });
            }