1
Vote

SimpleIOC - either add SetInstance or change GetInstance to support parameters

description

Hi. Great toolkit, thank you!

If I am not mistaken, neither of these is available, and I would like to see them added. If I am mistaken, please tell me how to do it, or I can ask the question on stackoverflow as you you request.

I would like to have a SetInstance so we can create our own viewmodel and add its instance to the SimpleIOC.

I would like to add parameters to the GetInstance for ViewModel instantiation.

comments

clairestreb wrote Aug 20, 2012 at 1:56 AM

I want to add that I do not know which ViewModel I am instantiating. I use something like the following
public static object CreateViewModel<T>(string fullVMName, params object[] parameters)
{
        Type typeOfVM = Type.GetType(fullVMName);
        object vm = Activator.CreateInstance(typeOfVM, params); // this is like xViewModel vm = new xViewModel(...)