We'll start by adding another class to our project, named SpatialParser
.
public class SpatialParser { public SpatialParser(string dataflowUri) { this.dataflowUri = dataflowUri; } }
This class will parse the geocoded data and will update the companies' records. In real life the latter would be stored in a database or other data store, but here we'll save it in memory. Thus, we create Company
:
public class Company { public string Id { get; set; } public string Name { get; set; } public Address Address { get; set; } public GeocodePoint Point { get; set; } public Company(string id, string name) { Id = id; Name = name; } }
And a
Companies
class that will operate as the data store:
public class Companies { private static IDictionary<string, Company> companies; public static IDictionary<string, Company> All { get { if (companies == null) { ...