/// <summary>
 /// looking for all loaded assemblies and return types where class contains <see cref="ExposeClassAttribute" />. with context equals specified context
 /// </summary>
 /// <param name="self">The self is  <see cref="ITypeReferential" /></param>
 /// <param name="context">The context that want to search in context attribute</param>
 /// <param name="typeBase">The type base if the list of type must inherit of specific type.</param>
 /// <returns>
 /// the list of types found, the key is the display name of <see cref="ExposeClassAttribute" />
 /// </returns>
 public static KeyValuePair <string, Type>[] GetTypesWithAttributeExposeClass(this ITypeReferential self, string context, Type typeBase = null)
 {
     return(self
            .GetTypesWithAttributes <Attributes.ExposeClassAttribute>(typeBase ?? typeof(object), attribute => attribute.Context == context)
            .Select(c => new KeyValuePair <string, Type>(TypeDescriptor.GetAttributes(c).OfType <ExposeClassAttribute>().FirstOrDefault().Name, c))
            .ToArray());
 }
Ejemplo n.º 2
0
 public MethodDiscoveryAssembly(ITypeReferential typeReferential, string startWith, Type inheritFrom)
 {
     _typeReferential = typeReferential;
     _startWith       = startWith;
     _inheritFrom     = inheritFrom;
 }