Class DependencyAttribute
This attribute is used to mark properties and parameters as targets for injection.
Inherited Members
Namespace: Unity
Assembly: Unity.Abstractions.dll
Syntax
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
public sealed class DependencyAttribute : DependencyResolutionAttribute
Remarks
For properties, this attribute is necessary for injection to happen. For parameters, it's not needed unless you want to specify additional information to control how the parameter is resolved.
Constructors
| Improve this Doc View SourceDependencyAttribute()
Create an instance of DependencyAttribute with no name.
Declaration
public DependencyAttribute()
DependencyAttribute(String)
Create an instance of DependencyAttribute with the given name.
Declaration
public DependencyAttribute(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name to use when resolving this dependency. |