Skip to content

Commit 1bd1f22

Browse files
author
Igor Evdokimov
committed
- hotfix fo DI (locations)
1 parent 4910a22 commit 1bd1f22

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Botticelli.Locations.Telegram/Extensions/ServiceCollectionExtensions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ public static IServiceCollection AddOsmLocations(this IServiceCollection service
3232
TypeAdapterConfig.GlobalSettings.Scan(Assembly.GetExecutingAssembly());
3333

3434
return services.Configure<LocationsProcessorOptions>(config)
35-
.AddScoped<ICommandValidator<FindLocationsCommand>, PassValidator<FindLocationsCommand>>()
36-
.AddScoped<ICommandValidator<MapCommand>, PassValidator<MapCommand>>()
35+
.AddSingleton<ICommandValidator<FindLocationsCommand>, PassValidator<FindLocationsCommand>>()
36+
.AddSingleton<ICommandValidator<MapCommand>, PassValidator<MapCommand>>()
3737
.AddScoped<FindLocationsCommandProcessor<InlineKeyboardMarkup>>()
3838
.AddScoped<MapCommandProcessor<ReplyKeyboardMarkup>>()
3939
.AddScoped<ILocationProvider, OsmLocationProvider>()
40-
.AddScoped<INominatimWebInterface, NominatimWebInterface>()
41-
.AddScoped<IAddressSearcher, AddressSearcher>()
42-
.AddScoped<ILayoutSupplier<InlineKeyboardMarkup>, InlineTelegramLayoutSupplier>()
43-
.AddScoped<ILayoutSupplier<ReplyKeyboardMarkup>, ReplyTelegramLayoutSupplier>()
44-
.AddScoped<IForwardGeocoder, ForwardGeocoder>(sp => new ForwardGeocoder(sp.GetRequiredService<INominatimWebInterface>(),
40+
.AddSingleton<INominatimWebInterface, NominatimWebInterface>()
41+
.AddSingleton<IAddressSearcher, AddressSearcher>()
42+
.AddSingleton<ILayoutSupplier<InlineKeyboardMarkup>, InlineTelegramLayoutSupplier>()
43+
.AddSingleton<ILayoutSupplier<ReplyKeyboardMarkup>, ReplyTelegramLayoutSupplier>()
44+
.AddSingleton<IForwardGeocoder, ForwardGeocoder>(sp => new ForwardGeocoder(sp.GetRequiredService<INominatimWebInterface>(),
4545
Url.Combine(url, "search")))
46-
.AddScoped<IReverseGeocoder, ReverseGeocoder>(sp => new ReverseGeocoder(sp.GetRequiredService<INominatimWebInterface>(),
46+
.AddSingleton<IReverseGeocoder, ReverseGeocoder>(sp => new ReverseGeocoder(sp.GetRequiredService<INominatimWebInterface>(),
4747
Url.Combine(url, "reverse")));
4848
}
4949
}

0 commit comments

Comments
 (0)