public static bool IsDisposalRequired(ComposablePartDefinition partDefinition) { Requires.NotNull(partDefinition, "partDefinition"); ReflectionComposablePartDefinition reflectionPartDefinition = partDefinition as ReflectionComposablePartDefinition; if (reflectionPartDefinition == null) { throw ExceptionBuilder.CreateReflectionModelInvalidPartDefinition("partDefinition", partDefinition.GetType()); } return reflectionPartDefinition.IsDisposalRequired; }
public static Lazy<Type> GetPartType(ComposablePartDefinition partDefinition) { Requires.NotNull(partDefinition, "partDefinition"); Contract.Ensures(Contract.Result<Lazy<Type>>() != null); ReflectionComposablePartDefinition reflectionPartDefinition = partDefinition as ReflectionComposablePartDefinition; if (reflectionPartDefinition == null) { throw ExceptionBuilder.CreateReflectionModelInvalidPartDefinition("partDefinition", partDefinition.GetType()); } return reflectionPartDefinition.GetLazyPartType(); }
public static bool IsDisposalRequired(ComposablePartDefinition partDefinition) { Requires.NotNull(partDefinition, "partDefinition"); ReflectionComposablePartDefinition reflectionPartDefinition = partDefinition as ReflectionComposablePartDefinition; if (reflectionPartDefinition == null) { throw new ArgumentException( string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidPartDefinition, partDefinition.GetType()), "partDefinition"); } return reflectionPartDefinition.IsDisposalRequired; }
public static Lazy<Type> GetPartType(ComposablePartDefinition partDefinition) { Requires.NotNull(partDefinition, "partDefinition"); Contract.Ensures(Contract.Result<Lazy<Type>>() != null); ReflectionComposablePartDefinition reflectionPartDefinition = partDefinition as ReflectionComposablePartDefinition; if (reflectionPartDefinition == null) { throw new ArgumentException( string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidPartDefinition, partDefinition.GetType()), "partDefinition"); } return reflectionPartDefinition.GetLazyPartType(); }
public static bool TryMakeGenericPartDefinition(ComposablePartDefinition partDefinition, IEnumerable<Type> genericParameters, out ComposablePartDefinition specialization) { Requires.NotNull(partDefinition, "partDefinition"); specialization = null; ReflectionComposablePartDefinition reflectionPartDefinition = partDefinition as ReflectionComposablePartDefinition; if (reflectionPartDefinition == null) { throw ExceptionBuilder.CreateReflectionModelInvalidPartDefinition("partDefinition", partDefinition.GetType()); } return reflectionPartDefinition.TryMakeGenericPartDefinition(genericParameters.ToArray(), out specialization); }