Exemplo 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));
Exemplo n.º 2
0
            public bool AppliesTo(Type implementationType, InitializerContext context)
            {
                var typeHierarchy = Types.GetTypeHierarchyFor(implementationType);

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