1
votes

NamedLikeFactoryMethod in Ninject Extensions Factory working in non-compliance with documentation

I am basically trying to do what the above post has listed but I guess the API has changed, When I look in the object browser I do not see an overload that would allow for this syntax.

I am trying the code below, I is making me use a NamedLikeFactoryMethod but when I do that it complains about the Bind<>.To<> portion, and either way I am unable to pickup the interface type to call the Create[Name] methods. Has this changed?

I am using Ninject 3, with the Ninject.Extension.Factory 3

Factory

public interface ITemplateProcessorFactory
    {
        ITemplateProcessor CreateXsltProcessor();
        ITemplateProcessor CreateRazorProcessor();
        ITemplateProcessor CreateMarkdownProcessor();
    }

Binding

Bind<ITemplateProcessor>().To<XsltProcessor>().NamedLikeFactoryMethod((ITemplateProcessorFactory)t => t.);
Bind<ITemplateProcessor>().To<XsltProcessor>().NamedLikeFactoryMethod<ITemplateProcessor,ITemplateProcessorFactory(t => t.);
1

1 Answers

1
votes

You have to name your methods GetXXX otherwise the factory will request instances without using a name.