Skip to content

Make gmaps DI (depedency injection) friendly library #95

@ericnewton76

Description

@ericnewton76

I believe this requires some refactoring that might slightly modify the public interfaces, but for a good cause: depedency injection and inversion of control concepts.

For instance, instead of

var request = new GeocodingRequest();
request.Address = "1600 Amphitheatre Parkway";
request.Sensor = false;
var response = new GeocodingService().GetResponse(request);

DI friendly public interfaces would make the following code, which is much more DI friendly itself:

public class Consumer 
{
  private IGeocodingService _GeocodingService;
  public Consumer(IGeocodingService GeocodingService) { ... }
   
  public void DoWork()
  {
    IGeocodingRequest request = _GeocodingService.CreateRequest();
    request.Address = "1600 Amphitheatre Parkway";
    var response = _GeocodingService.GetResponse(request);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions