Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better api for Dependency Injection #152

Open
avin-kavish opened this issue Jun 6, 2019 · 0 comments
Open

Better api for Dependency Injection #152

avin-kavish opened this issue Jun 6, 2019 · 0 comments

Comments

@avin-kavish
Copy link

avin-kavish commented Jun 6, 2019

Along with the interface extraction going on for v2, I think it would be a good idea to expose an ASP NET friendly service registration API that fits in to the existing Service Configuration paradigm.

A similar monolithic API with multiple sub-services is AWS. AWS has a separate DI package that adds the following (and other) extension methods to the Microsoft.Extensions.DependencyInjection namespace

  services.AddDefaultAWSOptions(awsOptions);
  services.AddAWSService<IAmazonS3>();

A similar setup would make this library more practical and easier to use in ASP NET (Core) applications

services.AddDefaultGMapsOptions(/* API key etc */);
services.Configure<DefaultGMapsOptions>(options => {
  options.ApiKey = 'blah blah';
  options.Timeout = TimeSpan.FromSeconds(5);
  /* etc */
});
services.AddGMapsService<IGMapsGeocoding>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant