Yeah, something along those lines.
How is that a Windsor dependency? It's not something your code would be using but Windsor. -- Krzysztof Kozmic On Thursday, 8 November 2012 at 7:33 AM, Scott McFadden wrote: > Rats, was hoping to not have any additional Windsor dependencies. Guess I > need to go implement this one. > > ? > (http://docs.castleproject.org/Windsor.Typed-Factory-Facility-interface-based-factories.ashx#) > > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > 10 > 11 > > public class CustomTypedFactoryComponentSelector : > DefaultTypedFactoryComponentSelector > { > protected override string GetComponentName(MethodInfo method, object[] > arguments) > { > if(method.Name == "GetById" && arguments.Length == 1 && arguments[0] > is string) > { > return (string)arguments[0]; > } > return base.GetComponentName(method, arguments); > } > } > > > > > > > > > > Thanks > > > On Wed, Nov 7, 2012 at 3:18 PM, Krzysztof Kozmic <[email protected] > (mailto:[email protected])> wrote: > > The default convention doesn't cover resolving by component name. You need > > to override it. > > > > > > > > -- > > Krzysztof Kozmic > > > > > > On Thursday, 8 November 2012 at 7:15 AM, Scott_M wrote: > > > > > We are using the Windsor Typed Factory Facility in an attempt to resolve > > > components by component name. > > > > > > Here is our Factory interface > > > > > > public interface ILookupFormatterFactory > > > { > > > //Relies on windsor typed factory for implementation > > > > > > ILookupFormatter Create(string componentId); > > > > > > void Release(); > > > } > > > > > > > > > Here is our registration code: > > > container.Register( > > > Component.For<ILookupFormatter>() > > > > > > .ImplementedBy<DefaultLookupFormatter>().LifeStyle.Transient > > > .Named("DefaultLookupFormatter") > > > ); > > > > > > container.Register( > > > Component.For<ILookupFormatter>() > > > > > > .ImplementedBy<RegexLookupFormatter>().LifeStyle.Transient > > > .Named("RegexLookupFormatter") > > > ); > > > > > > container.Register( > > > > > > Component.For<ILookupFormatterFactory>().LifeStyle.Transient > > > .AsFactory() > > > ); > > > > > > > > > > > > When we resolve by name (factory.Create("RegexLookupFormatter") the wrong > > > component is returned (component with DefaultLookupFormatter is > > > returned). What are we doing wrong? > > > > > > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Castle Project Users" group. > > > To view this discussion on the web visit > > > https://groups.google.com/d/msg/castle-project-users/-/MqTulYtQkZgJ. > > > To post to this group, send email to > > > [email protected] > > > (mailto:[email protected]). > > > To unsubscribe from this group, send email to > > > [email protected] > > > (mailto:[email protected]). > > > For more options, visit this group at > > > http://groups.google.com/group/castle-project-users?hl=en. > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Castle Project Users" group. > > To post to this group, send email to [email protected] > > (mailto:[email protected]). > > To unsubscribe from this group, send email to > > [email protected] > > (mailto:castle-project-users%[email protected]). > > For more options, visit this group at > > http://groups.google.com/group/castle-project-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To post to this group, send email to [email protected] > (mailto:[email protected]). > To unsubscribe from this group, send email to > [email protected] > (mailto:[email protected]). > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
