Ejemplo n.º 1
0
 // NOTE: MakeGenericType will fail for IEnumerable<T> when T is a pointer.
 private bool ContainsCollectionRegistrationFor(Type serviceType) =>
 !Types.IsGenericCollectionType(serviceType) && !serviceType.IsPointer &&
 this.ContainsExplicitRegistrationFor(typeof(IEnumerable <>).MakeGenericType(serviceType));
Ejemplo n.º 2
0
            public bool AppliesTo(Type implementationType, InitializerContext context)
            {
                var typeHierarchy = Types.GetTypeHierarchyFor(implementationType);

                return(typeHierarchy.Contains(this.serviceType));
            }
Ejemplo n.º 3
0
 private bool ContainsOneToOneRegistrationForCollectionType(Type collectionServiceType) =>
 Types.IsGenericCollectionType(collectionServiceType) &&
 this.ContainsExplicitRegistrationFor(collectionServiceType.GetGenericArguments()[0]);