Using Ninject IOC to replace a factory
问题 I've got a factory method inside a parser. Essentially as I load a token I look up the handler for that token, or drop through to the default handler. I've implemented this as a switch and as a Dictionary<string,Type> but both approaches require me to store the mapping somewhere else than the handler class. We are using Ninject for IOC and so I've realized I can also do it using kernel.Get<ITokenHandler>(tokenName); but that doesn't save me storing the information on what token the handler