示例#1
0
 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));
     }
 }