Tx.Core.DI.Multiple.Intances
1.1.2025.10
dotnet add package Tx.Core.DI.Multiple.Intances --version 1.1.2025.10
NuGet\Install-Package Tx.Core.DI.Multiple.Intances -Version 1.1.2025.10
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tx.Core.DI.Multiple.Intances" Version="1.1.2025.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tx.Core.DI.Multiple.Intances --version 1.1.2025.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Tx.Core.DI.Multiple.Intances, 1.1.2025.10"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Tx.Core.DI.Multiple.Intances as a Cake Addin #addin nuget:?package=Tx.Core.DI.Multiple.Intances&version=1.1.2025.10 // Install Tx.Core.DI.Multiple.Intances as a Cake Tool #tool nuget:?package=Tx.Core.DI.Multiple.Intances&version=1.1.2025.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Exmaple:
- Implement ICustomServiceWrapper<> for the multi-instance service
public class CustomTopicClient : ICustomServiceWrapper<ITopicClient>
{
public string Name { get; }
public ITopicClient CustomService { get; }
public CustomTopicClient(string name, ITopicClient customService)
{
Name = name;
CustomService = customService;
}
}
- Register multiple instance in the Container
services.AddSingleton<ICustomServiceWrapper<ITopicClient>>(opt => {
var client = new TopicClient("Some ConnStr", "Topic-1");
var customService = new CustomTopicClient("Instance-1", client);
return customService;
});
services.AddSingleton<ICustomServiceWrapper<ITopicClient>>(opt => {
var client = new TopicClient("Some ConnStr", "Topic-2");
var customService = new CustomTopicClient("Instance-2", client);
return customService;
});
- Resolve the Instance in your class
public class QueueReport
{
private readonly CustomServiceResolver<ITopicClient, ICustomServiceWrapper<ITopicClient>> _serviceResolver;
private readonly ITopicClient _client
public QueueReport(CustomServiceResolver<ITopicClient, ICustomServiceWrapper<ITopicClient>> serviceResolver)
{
_serviceResolver = serviceResolver;
_client = _serviceResolver.GetServiceByName("Instance-1");
}
public async Task Handle(AccessVerifiedEvent notification, CancellationToken cancellationToken)
{
await _client.SendAsync(Message);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.2025.10 | 70 | 2/10/2025 |
1.0.2 | 331 | 11/28/2022 |
1.0.1.1 | 300 | 11/27/2022 |
Upgrate to net 9.0