Example #1
0
        private Tuple <ITypeSpecBuilder, ImmutableDictionary <string, ITypeSpecBuilder> > LoadSpecificationAndCache(Type type, ImmutableDictionary <string, ITypeSpecBuilder> metamodel)
        {
            ITypeSpecBuilder specification = metamodel[ClassStrategy.GetKeyForType(type)];

            if (specification == null)
            {
                throw new ReflectionException(Log.LogAndReturn($"unrecognised type {type.FullName}"));
            }

            metamodel = specification.Introspect(facetDecoratorSet, new Introspector(this), metamodel);

            return(new Tuple <ITypeSpecBuilder, ImmutableDictionary <string, ITypeSpecBuilder> >(specification, metamodel));
        }
        private ITypeSpecBuilder LoadSpecificationAndCache(Type type)
        {
            Type actualType = classStrategy.GetType(type);

            if (actualType == null)
            {
                throw new ReflectionException(Log.LogAndReturn($"Attempting to introspect a non-introspectable type {type.FullName} "));
            }

            ITypeSpecBuilder specification = CreateSpecification(actualType);

            if (specification == null)
            {
                throw new ReflectionException(Log.LogAndReturn($"unrecognised type {actualType.FullName}"));
            }

            // We need the specification available in cache even though not yet fully introspected
            metamodel.Add(actualType, specification);

            specification.Introspect(facetDecoratorSet, new Introspector(this));

            return(specification);
        }