InTheHand.DependencyInjection
1.0.0
Prefix Reserved
dotnet add package InTheHand.DependencyInjection --version 1.0.0
NuGet\Install-Package InTheHand.DependencyInjection -Version 1.0.0
<PackageReference Include="InTheHand.DependencyInjection" Version="1.0.0" />
paket add InTheHand.DependencyInjection --version 1.0.0
#r "nuget: InTheHand.DependencyInjection, 1.0.0"
// Install InTheHand.DependencyInjection as a Cake Addin #addin nuget:?package=InTheHand.DependencyInjection&version=1.0.0 // Install InTheHand.DependencyInjection as a Cake Tool #tool nuget:?package=InTheHand.DependencyInjection&version=1.0.0
InTheHand.DependencyInjection
A self-contained implementation of the Xamarin.Forms DependencyService for all .NET 6.0 (and later) platforms. Usage is the same as in Xamarin forms with the exception that DependencyAttribute is not currently used to register types automatically.
Xamarin.Forms DependencyService Introduction - Microsoft Learn
Usage
Register a type with DependencyService.Register<YourType>();
or with an interface and a specific implementation using DependencyService.Register<IYourInterface, YourType>();
Retrieve an instance with DependencyService.Get<IYourInterface>();
using the interface or class type your registered.
Optionally specify whether to return a global instance or a new instance using the fetchTarget argument. e.g. for a new instance:
var newInstance = DependencyService.Get<IYourInterface>(DependencyFetchTarget.NewInstance);
This class extends the DependencyService with support for parameterized constructors.
For example when registering a type MyType
with a default constructor of the form MyType(IService1 service1, IService2 service2)
the DependencyService will look up those types in the container
and instantiate these using either a singleton or a new instance depending on how they were registered and inject them into the constructor.
The types referenced must have been registered with DependencyService prior to the call to Get which references them.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on InTheHand.DependencyInjection:
Repository | Stars |
---|---|
unoplatform/Uno.Samples
A collection of code samples for the Uno Platform
|
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 887 | 8/26/2023 |