/// <summary> /// Specifies a namespace in which to look for candidate implementations /// by one of the types that it contains. /// </summary> /// <param name="conv"></param> /// <param name="includeChildren"> /// true to include child namespaces, otherwise false. /// </param> /// <typeparam name="T"> /// A type in the assembly containing candidate implementations. /// </typeparam> /// <returns></returns> public static IConventionByScan FromNamespaceOf <T> (this IConventionByScan conv, bool includeChildren = false) => conv.FromNamespace(typeof(T).Namespace + (includeChildren ? ".*" : ""));
/// <summary> /// Specifies that candidate implementations must be decorated with /// the given attribute. /// </summary> /// <param name="conv"></param> /// <typeparam name="T"> /// The attribute to check for. /// </typeparam> /// <returns></returns> public static IConventionByScan WithAttribute <T>(this IConventionByScan conv) where T : Attribute => conv.Where((t1, t2) => t2.GetCustomAttributes <T>().Any());
/// <summary> /// Specifies an assembly in which to look for candidate implementations /// by one of the types that it contains. /// </summary> /// <param name="conv"></param> /// <typeparam name="T"> /// A type in the assembly containing candidate implementations. /// </typeparam> /// <returns></returns> public static IConventionByScan FromAssemblyContaining <T>(this IConventionByScan conv) => conv.FromAssembly(typeof(T).Assembly);