Beispiel #1
0
 /// <summary>
 /// Registers the by type match.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="basedOnType">Type of the based on.</param>
 /// <param name="predicate">The predicate.</param>
 /// <param name="assemblies">The assemblies.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterByTypeMatch(this Lazy <IServiceLocator> service, Type basedOnType, Predicate <Type> predicate, params Assembly[] assemblies)
 {
     ServiceLocatorManager.GetSetupDescriptor(service).Do(l => RegisterByTypeMatch(l.Registrar, basedOnType, predicate, assemblies)); return(service);
 }
 /// <summary>
 /// Loads from configuration.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="configuration">The configuration.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> LoadFromConfiguration(this Lazy <IServiceLocator> service, ServiceLocatorConfiguration configuration)
 {
     ServiceLocatorManager.GetSetupDescriptor(service).LoadFromConfiguration(service, configuration); return(service);
 }
Beispiel #3
0
 /// <summary>
 /// Registers the by type match.
 /// </summary>
 /// <typeparam name="TBasedOn">The type of the based on.</typeparam>
 /// <param name="service">The service.</param>
 /// <param name="assemblies">The assemblies.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterByTypeMatch <TBasedOn>(this Lazy <IServiceLocator> service, params Assembly[] assemblies)
 {
     ServiceLocatorManager.GetSetupDescriptor(service).Do(l => RegisterByTypeMatch(l.Registrar, typeof(TBasedOn), null, assemblies)); return(service);
 }
Beispiel #4
0
 /// <summary>
 /// Registers the by type match.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="basedOnType">Type of the based on.</param>
 /// <param name="predicate">The predicate.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterByTypeMatch(this Lazy <IServiceLocator> service, Type basedOnType, Predicate <Type> predicate)
 {
     var assembiles = new[] { GetPreviousCallingMethodAssembly() }; ServiceLocatorManager.GetSetupDescriptor(service).Do(l => RegisterByTypeMatch(l.Registrar, basedOnType, predicate, assembiles)); return(service);
 }
Beispiel #5
0
 /// <summary>
 /// Registers the by naming convention.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="predicate">The predicate.</param>
 /// <param name="assemblies">The assemblies.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterByNamingConvention(this Lazy <IServiceLocator> service, Predicate <Type> predicate, params Assembly[] assemblies)
 {
     ServiceLocatorManager.GetSetupDescriptor(service).Do(l => RegisterByNamingConvention(l.Registrar, predicate, assemblies)); return(service);
 }
Beispiel #6
0
 //
 /// <summary>
 /// Registers the by type match.
 /// </summary>
 /// <typeparam name="TBasedOn">The type of the based on.</typeparam>
 /// <param name="service">The service.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterByTypeMatch <TBasedOn>(this Lazy <IServiceLocator> service)
 {
     var assembiles = new[] { GetPreviousCallingMethodAssembly() }; ServiceLocatorManager.GetSetupDescriptor(service).Do(l => RegisterByTypeMatch(l.Registrar, typeof(TBasedOn), null, assembiles)); return(service);
 }
Beispiel #7
0
 /// <summary>
 /// Registers the by I service registration.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="assemblies">The assemblies.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterByIServiceRegistration(this Lazy <IServiceLocator> service, params Assembly[] assemblies)
 {
     ServiceLocatorManager.GetSetupDescriptor(service).Do(l => RegisterByIServiceRegistration(l.Registrar, null, assemblies)); return(service);
 }
Beispiel #8
0
 //
 /// <summary>
 /// Registers the by naming convention.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterByNamingConvention(this Lazy <IServiceLocator> service)
 {
     var assembiles = new[] { GetPreviousCallingMethodAssembly() }; ServiceLocatorManager.GetSetupDescriptor(service).Do(l => RegisterByNamingConvention(l.Registrar, null, assembiles)); return(service);
 }
Beispiel #9
0
 /// <summary>
 /// Registers the with service locator.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="locator">The locator.</param>
 /// <param name="name">The name.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterWithServiceLocator(this Lazy <IServiceLocator> service, IServiceLocator locator, string name)
 {
     ServiceLocatorManager.GetSetupDescriptor(service).RegisterWithServiceLocator(service, locator, name); return(service);
 }
Beispiel #10
0
 /// <summary>
 /// Registers the with service locator.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="service">The service.</param>
 /// <param name="locator">The locator.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterWithServiceLocator <T>(this Lazy <IServiceLocator> service, IServiceLocator locator)
     where T : class, IServiceLocator
 {
     ServiceLocatorManager.GetSetupDescriptor(service).RegisterWithServiceLocator <T>(service, locator, null); return(service);
 }
Beispiel #11
0
 /// <summary>
 /// Registers the with service locator.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="locator">The locator.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterWithServiceLocator(this Lazy <IServiceLocator> service, Lazy <IServiceLocator> locator)
 {
     ServiceLocatorManager.GetSetupDescriptor(service).RegisterWithServiceLocator(service, locator, null); return(service);
 }
Beispiel #12
0
 /// <summary>
 /// Registers the with service locator.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="name">The name.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> RegisterWithServiceLocator <T>(this Lazy <IServiceLocator> service, string name)
     where T : class, IServiceLocator
 {
     ServiceLocatorManager.GetSetupDescriptor(service).RegisterWithServiceLocator <T>(service, ServiceLocatorManager.Lazy, name); return(service);
 }
Beispiel #13
0
 /// <summary>
 /// Registers the specified service.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="registrant">The registrant.</param>
 /// <returns></returns>
 public static Lazy <IServiceLocator> Register(this Lazy <IServiceLocator> service, Action <IServiceRegistrar> registrant)
 {
     ServiceLocatorManager.GetSetupDescriptor(service).Do(l => registrant(l.Registrar)); return(service);
 }