-
Notifications
You must be signed in to change notification settings - Fork 370
Open
Description
Discussed in #800
Originally posted by Touseefelahi November 23, 2023
How to use keyed services in my Avalonia Application?
I am trying to use the keyed services feature from .net 8, but it is not working for me.
This is what I have in my App.axaml.cs file
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using CommunityToolkit.Mvvm.DependencyInjection;
var services = new ServiceCollection();
services.AddKeyedTransient<IUnitOfWork, UnitOfWork>(ServiceList.LocalDB);
Ioc.Default.ConfigureServices(ConfigureServices());
This is how I am trying to get the keyed service in some other class
Ioc.Default.GetRequiredKeyedService<IUnitOfWork>("LocalDB");
This is the error that I am getting:
This service provider doesn't support keyed services.
Am I missing something here? or the feature is not implemented yet?
Thank you
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels