This project is read-only.

Using Ninject for the Builder Pattern

Jan 30, 2015 at 9:13 PM

In reference to the above article, I'm not completely sure the answer that was provided is any different from using a switch-case like this:

switch (chartBuildType)
case : Temperature
director = new ChartDirector(new TemperatureChartBuilder());

How can I use contextual binding to get a different implementation based on user input at runtime?
Jan 30, 2015 at 9:56 PM
I understood the solution from the stack overflow now.

kernel.Get<IChatBuilder>("TemperatureChartBuilder") doesnt necessarily need to be hard-coded. But before calling the the ChartDirector, this could be done as follows:

director = new ChartDirector(kernel.Get<IChartBuilder>(String.Format("{0}Builder", ChartTypeEnum.ToString())))