public static ComposablePart CreatePart(object attributedPart, ReflectionContext reflectionContext) { Requires.NotNull(attributedPart, nameof(attributedPart)); Requires.NotNull(reflectionContext, nameof(reflectionContext)); return(AttributedModelDiscovery.CreatePart(attributedPart, reflectionContext)); }
public static ComposablePart CreatePart(object attributedPart) { Requires.NotNull(attributedPart, nameof(attributedPart)); Contract.Ensures(Contract.Result <ComposablePart>() != null); return(AttributedModelDiscovery.CreatePart(attributedPart)); }
public static ComposablePart CreatePart(object attributedPart, ReflectionContext reflectionContext) { Requires.NotNull(attributedPart, "attributedPart"); Requires.NotNull(reflectionContext, "reflectionContext"); Contract.Ensures(Contract.Result <ComposablePart>() != null); return(AttributedModelDiscovery.CreatePart(attributedPart, reflectionContext)); }
public static IEnumerable <Type> GetAttributedTypes() { foreach (Type type in typeof(Expectations).Assembly.GetTypes()) { var definition = AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(type, (ICompositionElement)null); if (definition != null) { yield return(type); } } }
public static ComposablePartDefinition CreatePartDefinition(Type type, ICompositionElement?origin, bool ensureIsDiscoverable) { Requires.NotNull(type, nameof(type)); if (ensureIsDiscoverable) { return(AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(type, origin) !); } else { return(AttributedModelDiscovery.CreatePartDefinition(type, null, false, origin)); } }
public static ComposablePart CreatePart(ComposablePartDefinition partDefinition, object attributedPart) { Requires.NotNull(partDefinition, nameof(partDefinition)); Requires.NotNull(attributedPart, nameof(attributedPart)); var reflectionComposablePartDefinition = partDefinition as ReflectionComposablePartDefinition; if (reflectionComposablePartDefinition == null) { throw ExceptionBuilder.CreateReflectionModelInvalidPartDefinition(nameof(partDefinition), partDefinition.GetType()); } return(AttributedModelDiscovery.CreatePart(reflectionComposablePartDefinition, attributedPart)); }
public static ComposablePart CreatePart(ComposablePartDefinition partDefinition, object attributedPart) { Requires.NotNull(partDefinition, "partDefinition"); Requires.NotNull(attributedPart, "attributedPart"); Contract.Ensures(Contract.Result <ComposablePart>() != null); var reflectionComposablePartDefinition = partDefinition as ReflectionComposablePartDefinition; if (reflectionComposablePartDefinition == null) { throw ExceptionBuilder.CreateReflectionModelInvalidPartDefinition("partDefinition", partDefinition.GetType()); } return(AttributedModelDiscovery.CreatePart(reflectionComposablePartDefinition, attributedPart)); }
public static ReflectionComposablePartDefinition CreateAttributed(Type type) { return(AttributedModelDiscovery.CreatePartDefinition(type, null, false, (ICompositionElement)null)); }
public static ComposablePart CreatePart(object attributedPart) { Requires.NotNull(attributedPart, nameof(attributedPart)); return(AttributedModelDiscovery.CreatePart(attributedPart)); }