コード例 #1
0
 /// <summary>
 /// Exposes a service type to ExpandR, so that plugins can implement it.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <param name="lifetime">The lifetime of the service.</param>
 /// <param name="multiple">Whether the service can have multiple implementations, or at most one.</param>
 /// <param name="defaultFactory">Default factory implementation for the service.</param>
 public static void Expose <TService>(this IExpandR expandr, ServiceLifetime lifetime, bool multiple, Func <IServiceProvider, TService> defaultFactory)
 => expandr.Expose(typeof(TService), lifetime, multiple, ExposedImplementation.FromFactory(defaultFactory));
コード例 #2
0
 /// <summary>
 /// Exposes a singleton service type to ExpandR, so that plugins may provide multiple implementations.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <typeparam name="TDefaultImpl">The default implementation type.</typeparam>
 public static void ExposeMultiSingleton <TService, TDefaultImpl>(this IExpandR expandr)
 => expandr.Expose <TService, TDefaultImpl>(ServiceLifetime.Singleton, true);
コード例 #3
0
 /// <summary>
 /// Exposes a service type to ExpandR, so that plugins can implement it.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <param name="lifetime">The lifetime of the service.</param>
 /// <param name="multiple">Whether the service can have multiple implementations, or at most one.</param>
 /// <param name="defaultImpls">Default implementation(s) for the service.</param>
 public static void Expose <TService>(this IExpandR expandr, ServiceLifetime lifetime, bool multiple = false, params ExposedImplementation[] defaultImpls)
 => expandr.Expose(typeof(TService), lifetime, multiple, defaultImpls);
コード例 #4
0
 /// <summary>
 /// Exposes a singleton service type to ExpandR, so that plugins may provide multiple implementations.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <param name="defaultImpls">Default implementations for the service.</param>
 public static void ExposeMultiSingleton <TService>(this IExpandR expandr, Func <IServiceProvider, TService> defaultFactory)
 => expandr.Expose <TService>(ServiceLifetime.Singleton, true, defaultFactory);
コード例 #5
0
 /// <summary>
 /// Exposes a singleton service type to ExpandR, so that plugins may provide multiple implementations.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <param name="defaultInstance">Default instance implementations for the service.</param>
 public static void ExposeMultiSingleton <TService>(this IExpandR expandr, TService defaultInstance)
 => expandr.Expose <TService>(ServiceLifetime.Singleton, true, _ => defaultInstance);
コード例 #6
0
 /// <summary>
 /// Exposes a scoped service type to ExpandR, so that plugins may provide multiple implementations.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <typeparam name="TDefaultImpl">The default implementation type.</typeparam>
 public static void ExposeMultiScoped <TService, TDefaultImpl>(this IExpandR expandr)
 => expandr.Expose <TService, TDefaultImpl>(ServiceLifetime.Scoped, true);
コード例 #7
0
 /// <summary>
 /// Exposes a singleton service type to ExpandR, so that plugins may provide multiple implementations.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <param name="defaultImpls">Default implementations for the service.</param>
 public static void ExposeMultiSingleton <TService>(this IExpandR expandr, params ExposedImplementation[] defaultImpls)
 => expandr.Expose(typeof(TService), ServiceLifetime.Singleton, true, defaultImpls);
コード例 #8
0
 /// <summary>
 /// Exposes a transient service type to ExpandR, so that plugins may provide multiple implementations.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <param name="defaultFactory">Default factory implementation for the service.</param>
 public static void ExposeMultiTransient <TService>(this IExpandR expandr, Func <IServiceProvider, TService> defaultFactory)
 => expandr.Expose <TService>(ServiceLifetime.Transient, true, defaultFactory);
コード例 #9
0
 /// <summary>
 /// Exposes a transient service type to ExpandR, so that plugins may provide multiple implementations.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <typeparam name="TDefaultImpl">The default implementation type.</typeparam>
 public static void ExposeMultiTransient <TService, TDefaultImpl>(this IExpandR expandr)
 => expandr.Expose <TService, TDefaultImpl>(ServiceLifetime.Transient, true);
コード例 #10
0
 /// <summary>
 /// Exposes a singleton service type to ExpandR, so that plugins can implement it.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <param name="multiple">Whether the service can have multiple implementations, or at most one.</param>
 /// <param name="defaultInstance">Default instance implementation for the service.</param>
 public static void ExposeSingleton <TService>(this IExpandR expandr, bool multiple, TService defaultInstance)
 => expandr.Expose <TService>(ServiceLifetime.Singleton, multiple, _ => defaultInstance);
コード例 #11
0
 /// <summary>
 /// Exposes a service type to ExpandR, so that plugins may provide multiple implementations.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <param name="lifetime">The lifetime of the service.</param>
 /// <param name="defaultFactory">Default factory implementation for the service.</param>
 public static void ExposeMulti <TService>(this IExpandR expandr, ServiceLifetime lifetime, Func <IServiceProvider, TService> defaultFactory)
 => expandr.Expose <TService>(lifetime, true, defaultFactory);
コード例 #12
0
 /// <summary>
 /// Exposes a singleton service type to ExpandR, so that plugins can implement it.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <typeparam name="TDefaultImpl">The default implementation type.</typeparam>
 /// <param name="multiple">Whether the service can have multiple implementations, or at most one.</param>
 public static void ExposeSingleton <TService, TDefaultImpl>(this IExpandR expandr, bool multiple = false)
 => expandr.Expose <TService, TDefaultImpl>(ServiceLifetime.Singleton, multiple);
コード例 #13
0
 /// <summary>
 /// Exposes a singleton service type to ExpandR, so that plugins can implement it.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <param name="multiple">Whether the service can have multiple implementations, or at most one.</param>
 /// <param name="defaultImpls">Default implementation(s) for the service.</param>
 public static void ExposeSingleton <TService>(this IExpandR expandr, bool multiple = false, params ExposedImplementation[] defaultImpls)
 => expandr.Expose <TService>(ServiceLifetime.Singleton, multiple, defaultImpls);
コード例 #14
0
 /// <summary>
 /// Exposes a scoped service type to ExpandR, so that plugins can implement it.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <param name="multiple">Whether the service can have multiple implementations, or at most one.</param>
 /// <param name="defaultFactory">Default factory implementation for the service.</param>
 public static void ExposeScoped <TService>(this IExpandR expandr, bool multiple, Func <IServiceProvider, TService> defaultFactory)
 => expandr.Expose <TService>(ServiceLifetime.Scoped, multiple, defaultFactory);
コード例 #15
0
 /// <summary>
 /// Exposes a transient service type to ExpandR, so that plugins can implement it.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <typeparam name="TDefaultImpl">The default implementation type.</typeparam>
 /// <param name="multiple">Whether the service can have multiple implementations, or at most one.</param>
 public static void ExposeTransient <TService, TDefaultImpl>(this IExpandR expandr, bool multiple = false)
 => expandr.Expose <TService, TDefaultImpl>(ServiceLifetime.Transient, multiple);
コード例 #16
0
 /// <summary>
 /// Exposes a service type to ExpandR, so that plugins can implement it.
 /// </summary>
 /// <typeparam name="TService">The service (interface) type.</typeparam>
 /// <typeparam name="TDefaultImpl">The default implementation type.</typeparam>
 /// <param name="lifetime">The lifetime of the service.</param>
 /// <param name="multiple">Whether the service can have multiple implementations, or at most one.</param>
 public static void Expose <TService, TDefaultImpl>(this IExpandR expandr, ServiceLifetime lifetime, bool multiple = false)
 => expandr.Expose(typeof(TService), lifetime, multiple, ExposedImplementation.FromType <TDefaultImpl>());