Struct InjectedCollection<T>
Marks a property for property injection by the IoC container. When a class uses properties of this type is constructed via the IoC container or BuildUp is called properties of this type are injected by the system. For objects constructed maually via new the services are located using the global service locator object.
Implements
Inherited Members
Namespace: EPiServer.ServiceLocation
Assembly: EPiServer.Framework.dll
Version: 9.12.2Syntax
public struct InjectedCollection<T> : IEnumerable<T>, IEnumerable where T : class
Type Parameters
Name | Description |
---|---|
T | The type of service to inject all instances of. |
Constructors
InjectedCollection(ServiceCollectionAccessor<T>)
Initializes an instance with a specific service accessor.
Declaration
public InjectedCollection(ServiceCollectionAccessor<T> accessor)
Parameters
Type | Name | Description |
---|---|---|
ServiceCollectionAccessor<T> | accessor | The accessor delegate to use for retrieving the services. |
InjectedCollection(IEnumerable<T>)
Initializes an instance with a specific service accessor.
Declaration
public InjectedCollection(IEnumerable<T> services)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | services | The services to use. |
Properties
Services
The injected services. This property is lazily resolved when first used.
Declaration
public IEnumerable<T> Services { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> |
Methods
GetEnumerator()
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T> |
Operators
Implicit(T[] to InjectedCollection<T>)
Simplifies assignment to injected services.
Declaration
public static implicit operator InjectedCollection<T>(T[] services)
Parameters
Type | Name | Description |
---|---|---|
T[] | services | The services to assign. |
Returns
Type | Description |
---|---|
InjectedCollection<T> | An injected collection with the services assigned. |
Implicit(List<T> to InjectedCollection<T>)
Simplifies assignment to injected services.
Declaration
public static implicit operator InjectedCollection<T>(List<T> services)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<T> | services | The services to assign. |
Returns
Type | Description |
---|---|
InjectedCollection<T> | An injected collection with the service assigned. |
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |