lundi 31 octobre 2016

Conditonaly inject Dependancy injection

I am injecting dependancy in action method of mvc controller .

Scenerio - i want to use interface in action method of mvc controller. This interface is implemented by 2 classes . for example modelA and modelB both are inherited from interfaceA . on runtime when user change the value in dropdown according to the value of dropdown dependancy injection should determine it should inject modelA object or modelB object .

Also i am not sure is DI is the solution or any other solution exists . or factory patter not sure .

Aucun commentaire:

Enregistrer un commentaire