System.Reflection.ReflectionContext.MapType C# (CSharp) Method

MapType() public abstract method

public abstract MapType ( TypeInfo type ) : TypeInfo
type TypeInfo
return TypeInfo
		public abstract TypeInfo MapType (TypeInfo type);
	}

Usage Example

Esempio n. 1
0
        public static ReflectionComposablePart CreatePart(object attributedPart, ReflectionContext reflectionContext)
        {
            Assumes.NotNull(attributedPart);
            Assumes.NotNull(reflectionContext);

            // If given an instance then we want to pass the default composition options because we treat it as a shared part
            // TODO: ICompositionElement Give this def an origin indicating that it was added directly to the ComposablePartExportProvider.

            var mappedType = reflectionContext.MapType(IntrospectionExtensions.GetTypeInfo(attributedPart.GetType()));
            if (mappedType.Assembly.ReflectionOnly)
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.Argument_ReflectionContextReturnsReflectionOnlyType, "reflectionContext"), "reflectionContext");
            }

            ReflectionComposablePartDefinition definition = AttributedModelDiscovery.CreatePartDefinition(mappedType, PartCreationPolicyAttribute.Shared, true, (ICompositionElement)null);

            return CreatePart(definition, attributedPart);
        }
All Usage Examples Of System.Reflection.ReflectionContext::MapType