Files
Pf2eDataScrapper/Pf2e/WPF/WpfServiceProviderExtension.cs
T

31 lines
1.1 KiB
C#

using Microsoft.Extensions.DependencyInjection;
using Pf2e.Scrapper.WPF.EntityViewer.Stores;
using Pf2e.Scrapper.WPF.EntityViewer.ViewModel;
namespace Pf2e.WPF;
/// <summary>
/// Расширение для IServiceCollection, позволяющее регистрировать сервисы WPF.
/// </summary>
public static class WpfServiceProviderExtension
{
/// <summary>
/// Регистрация сервисов WPF в IServiceCollection.
/// </summary>
/// <param name="collection">Коллекция сервисов.</param>
/// <returns>Коллекция сервисов (<paramref name="collection"/> для Fluent API).</returns>
public static IServiceCollection RegisterWpfServices(this IServiceCollection collection)
{
return collection
// ViewModels
.AddTransient<EntityFormViewModel>()
.AddTransient<EntityListViewModel>()
.AddTransient<ViewViewModel>()
// Stores
.AddSingleton<SelectedEntityTypeStore>()
.AddSingleton<SelectedEntityStore>()
//
;
}
}