Show / Hide Table of Contents

Class CompositionHelper

A composition helper.

Inheritance
System.Object
CompositionHelper
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Composition
Assembly: Kephas.Core.dll
Syntax
public static class CompositionHelper

Methods

| Improve this Doc View Source

ToPrioritizedDictionary<TService, TServiceMetadata, TKey>(IEnumerable<IExportFactory<TService, TServiceMetadata>>, Func<IExportFactory<TService, TServiceMetadata>, TKey>, IEqualityComparer<TKey>)

Converts this collection of service factories to a dictionary.

Declaration
public static IDictionary<TKey, IExportFactory<TService, TServiceMetadata>> ToPrioritizedDictionary<TService, TServiceMetadata, TKey>(this IEnumerable<IExportFactory<TService, TServiceMetadata>> serviceFactories, Func<IExportFactory<TService, TServiceMetadata>, TKey> keyFunc, IEqualityComparer<TKey> keyComparer = null)

    where TServiceMetadata : AppServiceMetadata
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IExportFactory<TService, TServiceMetadata>> serviceFactories

The service factories.

System.Func<IExportFactory<TService, TServiceMetadata>, TKey> keyFunc

The key function.

System.Collections.Generic.IEqualityComparer<TKey> keyComparer

Optional. The key comparer.

Returns
Type Description
System.Collections.Generic.IDictionary<TKey, IExportFactory<TService, TServiceMetadata>>

The given data converted to an IDictionary<TKey,TValue>.

Type Parameters
Name Description
TService

Type of the service.

TServiceMetadata

Type of the service metadata.

TKey

Type of the key.

Remarks

If, for the same key, there are multiple matching services, their override priority and processing priority is considered, in this order. Further, if both of these priorities are equal, then a DuplicateKeyException occurs.

| Improve this Doc View Source

ToPrioritizedDictionary<TService, TServiceMetadata, TKey, TValue>(IEnumerable<IExportFactory<TService, TServiceMetadata>>, Func<IExportFactory<TService, TServiceMetadata>, TKey>, Func<IExportFactory<TService, TServiceMetadata>, TValue>, IEqualityComparer<TKey>)

Converts this collection of service factories to a dictionary.

Declaration
public static IDictionary<TKey, TValue> ToPrioritizedDictionary<TService, TServiceMetadata, TKey, TValue>(this IEnumerable<IExportFactory<TService, TServiceMetadata>> serviceFactories, Func<IExportFactory<TService, TServiceMetadata>, TKey> keyFunc, Func<IExportFactory<TService, TServiceMetadata>, TValue> valueFunc, IEqualityComparer<TKey> keyComparer = null)

    where TServiceMetadata : AppServiceMetadata
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IExportFactory<TService, TServiceMetadata>> serviceFactories

The service factories.

System.Func<IExportFactory<TService, TServiceMetadata>, TKey> keyFunc

The key function.

System.Func<IExportFactory<TService, TServiceMetadata>, TValue> valueFunc

The value function.

System.Collections.Generic.IEqualityComparer<TKey> keyComparer

Optional. The key comparer.

Returns
Type Description
System.Collections.Generic.IDictionary<TKey, TValue>

The given data converted to a IDictionary<TKey,TValue>.

Type Parameters
Name Description
TService

Type of the service.

TServiceMetadata

Type of the service metadata.

TKey

Type of the dictionary key.

TValue

Type of the dictionary value.

Remarks

If, for the same key, there are multiple matching services, their override priority and processing priority is considered, in this order. Further, if both of these priorities are equal, then a DuplicateKeyException occurs.

Exceptions
Type Condition
DuplicateKeyException

Thrown when a Duplicate Key error condition occurs.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX