예제 #1
0
        public virtual bool IsIgnored(Type type)
        {
            var returnType = TypeKeyUtils.FilterNullableAndProxies(type);

            return(IsTypeIgnored(returnType) ||
                   IsTypeUnsupportedByReflector(returnType) ||
                   FasterTypeUtils.IsGenericCollection(type) && type.GetGenericArguments().Any(IsIgnored));
        }
예제 #2
0
        public bool IsTypeRecognized(Type type)
        {
            var returnType = TypeKeyUtils.FilterNullableAndProxies(type);

            return(!IsTypeIgnored(returnType) &&
                   !IsTypeUnsupportedByReflector(returnType) &&
                   IsTypeWhiteListed(returnType) &&
                   (!FasterTypeUtils.IsGenericCollection(type) || type.GetGenericArguments().All(IsTypeRecognized)));
        }
        public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
        {
            if (typeof(IEnumerable).IsAssignableFrom(type) && !FasterTypeUtils.IsSystem(type))
            {
                MethodInfo method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.GetEnumeratorMethod, null, Type.EmptyTypes);
                if (method != null)
                {
                    methodRemover.RemoveMethod(method);
                }
            }

            return(metamodel);
        }
예제 #4
0
        public override IImmutableDictionary <string, ITypeSpecBuilder> Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
        {
            var currentType = type;

            while (currentType != null)
            {
                if (FasterTypeUtils.IsSystem(currentType))
                {
                    ProcessSystemType(currentType, methodRemover, specification);
                }

                currentType = currentType.BaseType;
            }

            return(metamodel);
        }
        private void PopulateAssociatedActions(IObjectSpecBuilder spec, Type[] services, IMetamodelBuilder metamodel)
        {
            if (string.IsNullOrWhiteSpace(spec.FullName))
            {
                var id = spec.Identifier?.ClassName ?? "unknown";
                logger.LogWarning($"Specification with id : {id} has null or empty name");
            }

            if (FasterTypeUtils.IsSystem(spec.FullName) && !spec.IsCollection)
            {
                return;
            }

            if (FasterTypeUtils.IsNakedObjects(spec.FullName))
            {
                return;
            }

            PopulateContributedActions(spec, services, metamodel);
        }
예제 #6
0
 private Type GetSpecificationType(Type type) =>
 FasterTypeUtils.IsGenericCollection(type)
         ? type.GetGenericTypeDefinition()
         : FasterTypeUtils.IsObjectArray(type)
             ? typeof(Array)
             : ClassStrategy.GetType(type);