#### [Abblix\.DependencyInjection](https://www.abblix.com/en/docs/api/abblix-dependencyinjection 'index')
### [Abblix\.DependencyInjection](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection 'Abblix\.DependencyInjection')

## Dependency Struct

Represents a dependency that can be overridden in a service provider\.
This struct provides various static methods to create dependency overrides based on type, instance, or factory functions\.

```csharp
public readonly struct Dependency
```
### Methods

## Dependency\.Override\(Type, object\) Method {#Abblix.DependencyInjection.Dependency.Override(System.Type,object)}

Creates a dependency override with a specific instance for the declared type\.

```csharp
public static Abblix.DependencyInjection.Dependency Override(System.Type declared, object instance);
```
#### Parameters

###### `declared` [System\.Type](https://learn.microsoft.com/en-us/dotnet/api/system.type 'System\.Type') {#Abblix.DependencyInjection.Dependency.Override(System.Type,object).declared}

The declared type of the dependency\.

###### `instance` [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') {#Abblix.DependencyInjection.Dependency.Override(System.Type,object).instance}

The instance to use for the dependency\.

#### Returns
[Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency')  
A new [Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency') instance\.

## Dependency\.Override\(Type, Func\<IServiceProvider,object\>\) Method {#Abblix.DependencyInjection.Dependency.Override(System.Type,System.Func_System.IServiceProvider,object_)}

Creates a dependency override using a factory function for the declared type\.

```csharp
public static Abblix.DependencyInjection.Dependency Override(System.Type declared, System.Func<System.IServiceProvider,object> factory);
```
#### Parameters

###### `declared` [System\.Type](https://learn.microsoft.com/en-us/dotnet/api/system.type 'System\.Type') {#Abblix.DependencyInjection.Dependency.Override(System.Type,System.Func_System.IServiceProvider,object_).declared}

The declared type of the dependency\.

###### `factory` [System\.Func&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.func-2 'System\.Func\`2')[System\.IServiceProvider](https://learn.microsoft.com/en-us/dotnet/api/system.iserviceprovider 'System\.IServiceProvider')[,](https://learn.microsoft.com/en-us/dotnet/api/system.func-2 'System\.Func\`2')[System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.func-2 'System\.Func\`2') {#Abblix.DependencyInjection.Dependency.Override(System.Type,System.Func_System.IServiceProvider,object_).factory}

The factory function to create the dependency instance\.

#### Returns
[Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency')  
A new [Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency') instance\.

## Dependency\.Override\(Type, Type\) Method {#Abblix.DependencyInjection.Dependency.Override(System.Type,System.Type)}

Creates a dependency override where a specified actual type fulfills the contract of a declared type\.

```csharp
public static Abblix.DependencyInjection.Dependency Override(System.Type declared, System.Type actual);
```
#### Parameters

###### `declared` [System\.Type](https://learn.microsoft.com/en-us/dotnet/api/system.type 'System\.Type') {#Abblix.DependencyInjection.Dependency.Override(System.Type,System.Type).declared}

The declared type of the dependency\.

###### `actual` [System\.Type](https://learn.microsoft.com/en-us/dotnet/api/system.type 'System\.Type') {#Abblix.DependencyInjection.Dependency.Override(System.Type,System.Type).actual}

The actual type to be used as the implementation\.

#### Returns
[Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency')  
A new [Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency') instance\.

## Dependency\.Override\<TDeclared,TActual\>\(\) Method {#Abblix.DependencyInjection.Dependency.Override_TDeclared,TActual_()}

Creates a dependency override where a specified actual type fulfills the contract of a declared type\.

```csharp
public static Abblix.DependencyInjection.Dependency Override<TDeclared,TActual>()
    where TActual : TDeclared;
```
#### Type parameters

###### `TDeclared` {#Abblix.DependencyInjection.Dependency.Override_TDeclared,TActual_().TDeclared}

The declared type of the dependency\.

###### `TActual` {#Abblix.DependencyInjection.Dependency.Override_TDeclared,TActual_().TActual}

The actual type to be used as the implementation\.

#### Returns
[Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency')  
A new [Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency') instance\.

## Dependency\.Override\<TDeclared\>\(Func\<IServiceProvider,TDeclared\>\) Method {#Abblix.DependencyInjection.Dependency.Override_TDeclared_(System.Func_System.IServiceProvider,TDeclared_)}

Creates a dependency override using a factory function for the declared type\.

```csharp
public static Abblix.DependencyInjection.Dependency Override<TDeclared>(System.Func<System.IServiceProvider,TDeclared> factory);
```
#### Type parameters

###### `TDeclared` {#Abblix.DependencyInjection.Dependency.Override_TDeclared_(System.Func_System.IServiceProvider,TDeclared_).TDeclared}

The declared type of the dependency\.
#### Parameters

###### `factory` [System\.Func&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.func-2 'System\.Func\`2')[System\.IServiceProvider](https://learn.microsoft.com/en-us/dotnet/api/system.iserviceprovider 'System\.IServiceProvider')[,](https://learn.microsoft.com/en-us/dotnet/api/system.func-2 'System\.Func\`2')[TDeclared](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency#Abblix.DependencyInjection.Dependency.Override_TDeclared_(System.Func_System.IServiceProvider,TDeclared_).TDeclared 'Abblix\.DependencyInjection\.Dependency\.Override\<TDeclared\>\(System\.Func\<System\.IServiceProvider,TDeclared\>\)\.TDeclared')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.func-2 'System\.Func\`2') {#Abblix.DependencyInjection.Dependency.Override_TDeclared_(System.Func_System.IServiceProvider,TDeclared_).factory}

The factory function to create the dependency instance\.

#### Returns
[Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency')  
A new [Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency') instance\.

## Dependency\.Override\<TDeclared\>\(TDeclared\) Method {#Abblix.DependencyInjection.Dependency.Override_TDeclared_(TDeclared)}

Creates a dependency override with a specific instance for the declared type\.

```csharp
public static Abblix.DependencyInjection.Dependency Override<TDeclared>(TDeclared instance);
```
#### Type parameters

###### `TDeclared` {#Abblix.DependencyInjection.Dependency.Override_TDeclared_(TDeclared).TDeclared}

The declared type of the dependency\.
#### Parameters

###### `instance` [TDeclared](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency#Abblix.DependencyInjection.Dependency.Override_TDeclared_(TDeclared).TDeclared 'Abblix\.DependencyInjection\.Dependency\.Override\<TDeclared\>\(TDeclared\)\.TDeclared') {#Abblix.DependencyInjection.Dependency.Override_TDeclared_(TDeclared).instance}

The instance to use for the dependency\.

#### Returns
[Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency')  
A new [Dependency](https://www.abblix.com/en/docs/api/abblix-dependencyinjection/Abblix.DependencyInjection.Dependency 'Abblix\.DependencyInjection\.Dependency') instance\.
