/// <summary> /// Ups the priority of partially closed generics based on the number of closed parameters /// </summary> /// <param name="configuration">configuration object</param> /// <returns>configuration object</returns> public static IExportTypeSetConfiguration PrioritizePartiallyClosedGenerics( this IExportTypeSetConfiguration configuration) { configuration.WithInspector(new PartiallyClosedGenericPriorityAugmenter()); return(configuration); }
/// <summary> /// Export a type set by a keyed interface /// </summary> /// <typeparam name="T"></typeparam> /// <param name="configuration"></param> /// <param name="keyFunc"></param> /// <returns></returns> public static IExportTypeSetConfiguration ByKeyed <T>(this IExportTypeSetConfiguration configuration, Func <Type, object> keyFunc) { configuration.ByKeyedTypes(type => { if (typeof(T).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo())) { var key = keyFunc(type); if (key != null) { return(new[] { new Tuple <Type, object>(type, key) }); } return(null); } return(null); }); return(configuration); }
/// <summary> /// Registers all message handlers with the DispatchedMessenger /// Note: Message handlers are defined as public non-static methods that have one parameter /// and end in MessageHandler /// </summary> /// <param name="configuration">configuration object</param> /// <param name="messageHandlerPostfix">message handler postfix</param> /// <returns></returns> public static IExportTypeSetConfiguration RegisterMessageHandlers(this IExportTypeSetConfiguration configuration, string messageHandlerPostfix = null) { configuration.EnrichWithExpression(type => ProcessTypeForMessageHandlerMethods(type, messageHandlerPostfix)); return(configuration); }