Exemplo n.º 1
0
 public static IIocRegistrator RegisterManyTransient(
     this IIocRegistrator registrator,
     Type implementationType,
     bool autoInjectProperty = false)
 {
     return(registrator.RegisterMany(
                implementationType, autoInjectProperty, DependencyLifeTime.Transient));
 }
Exemplo n.º 2
0
 public static IIocRegistrator RegisterManySingleton(
     this IIocRegistrator registrator,
     IEnumerable <Type> implementationTypes,
     bool autoInjectProperty = false)
 {
     return(registrator.RegisterMany(
                implementationTypes, autoInjectProperty, DependencyLifeTime.Singleton));
 }
Exemplo n.º 3
0
 internal static IIocRegistrator RegisterMany(
     this IIocRegistrator registrator,
     Type implementationType,
     bool autoInjectProperty     = false,
     DependencyLifeTime lifeTime = DependencyLifeTime.Transient)
 {
     registrator.RegisterMany(
         new[] { implementationType }, autoInjectProperty, lifeTime);
     return(registrator);
 }
Exemplo n.º 4
0
 public static IIocRegistrator RegisterManyScoped(
     this IIocRegistrator registrator,
     IEnumerable <Type> seviceTypes,
     Type implementationType,
     bool autoInjectProperty = false)
 {
     registrator.RegisterMany(seviceTypes,
                              implementationType, autoInjectProperty, DependencyLifeTime.Scoped);
     return(registrator);
 }
Exemplo n.º 5
0
        internal static IIocRegistrator RegisterAssemblies(
            this IIocRegistrator registrator,
            IEnumerable <Assembly> assemblies,
            Func <Type, bool> typeSelector,
            bool autoInjectProperty,
            DependencyLifeTime lifeTime)
        {
            Check.NotNull(registrator, nameof(registrator));
            assemblies = assemblies ?? AppDomain.CurrentDomain.GetAssemblies();

            var types = assemblies
                        .SelectMany(asm => asm.DefinedTypes)
                        .Select(typeInfo => typeInfo.AsType())
                        .Where(type => typeSelector?.Invoke(type) ?? true);

            foreach (var type in types)
            {
                registrator.RegisterMany(type, autoInjectProperty, lifeTime);
            }

            return(registrator);
        }
Exemplo n.º 6
0
 public static IIocRegistrator RegisterManySingleton <TImplementation>(
     this IIocRegistrator registrator, bool autoInjectProperty = false)
 {
     return(registrator.RegisterMany <TImplementation>(
                autoInjectProperty, DependencyLifeTime.Singleton));
 }