/// <summary> /// Specifies that the candidate implementation should be found by /// replacing the given regular expression in the service name with /// the given replacement pattern. /// </summary> /// <param name="conv"></param> /// <param name="search"> /// The regular expression to search for in the name of the requested /// service. /// </param> /// <param name="replace"> /// The string or replacement pattern to replace it with in the name /// of the candidate implementation. /// </param> /// <returns></returns> public static IConventionByName Replace (this IConventionByName conv, Regex search, string replace) => conv.Named(t => search.Replace(t.Name, replace));
/// <summary> /// Specifies that the candidate implementation should be found by /// replacing the given regular expression in the service name with /// the value computed by the specified <see cref="MatchEvaluator"/> /// instance. /// </summary> /// <param name="conv"></param> /// <param name="search"> /// The regular expression to search for in the name of the requested /// service. /// </param> /// <param name="replace"> /// A <see cref="MatchEvaluator"/> function that computes the string /// to replace it with in the name of the candidate implementation. /// </param> /// <returns></returns> public static IConventionByName Replace (this IConventionByName conv, Regex search, MatchEvaluator replace) => conv.Named(t => search.Replace(t.Name, replace));
/* ====== Convention by name specific ====== */ /// <summary> /// Specifies that candidate implementations should be found by /// replacing the given search string in the service name by another. /// </summary> /// <param name="conv"></param> /// <param name="search"> /// The string to search for in the name of the requested service. /// </param> /// <param name="replace"> /// The string to replace it with in the name of the candidate /// implementation. /// </param> /// <returns></returns> public static IConventionByName Replace (this IConventionByName conv, string search, string replace) => conv.Named(t => t.Name.Replace(search, replace));