// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:posthelpgetdb"])); services.AddDefaultIdentity <IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores <ApplicationDbContext>(); services.AddControllersWithViews(); services.AddRazorPages(); var apiKey = Configuration["googleApiKey"]; var googleMapsConfig = new GoogleMapsConfig() { ApiKey = apiKey }; services.AddSingleton(googleMapsConfig); services.AddHttpClient <IMUAPService, MUAPService>(client => { client.BaseAddress = new Uri(Configuration["arcBaseAddress"]); }); services.AddHttpClient <IGeocodingService, GeocodingService>(client => { client.BaseAddress = new Uri(Configuration["googleMapsBase"]); }); services.AddTransient <ICombinedAPIService, CombinedAPIService>(); }
//A BIG Thanks to Kevin Jump, Your uSync Settings saved me time working the config out! https://github.com/KevinJump/uSync/blob/v9/main/uSync.BackOffice/uSyncBackOfficeBuilderExtensions.cs /// <summary> /// Registers the Google Maps Settings /// </summary> /// <param name="builder"></param> /// <param name="defaultOptions"></param> /// <returns></returns> public static IUmbracoBuilder AddGoogleMaps(this IUmbracoBuilder builder, Action <GoogleMapsConfig> defaultOptions = default) { // if the MetaMomentumConfig Service is registered then we assume this has been added before so we don't do it again. if (builder.Services.FirstOrDefault(x => x.ServiceType == typeof(GoogleMapsConfig)) != null) { return(builder); } var options = builder.Services.AddSingleton(r => { var ret = new GoogleMapsConfig(builder.Config); if (defaultOptions != default) { //Override with custom details defaultOptions.Invoke(ret); } return(ret); }); if (defaultOptions != default) { //options..Configure(defaultOptions); } return(builder); }
public GoogleMapsController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, GoogleMapsConfig settings, AppCaches appCaches, IProfilingLogger logger, global::Umbraco.Core.IRuntimeState runtimeState, UmbracoHelper umbracoHelper, UmbracoMapper umbracoMapper) : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper) #endif { this.googleMapsConfig = settings; }
public GeocodingService(HttpClient httpClient, GoogleMapsConfig googleMapsConfig) { _httpClient = httpClient; _googleMapsConfig = googleMapsConfig; _options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true, WriteIndented = true }; }
public SingleMapPropertyValueConverter(GoogleMapsConfig googleMapsConfig) { this.googleMapsConfig = googleMapsConfig; }
public GoogleMapsApi(IOptions <GoogleMapsConfig> config) { _config = config.Value; }
public GoogleMapsController(GoogleMapsConfig settings)