I am performing dependency injection.
I want to bind an interface to an object that can change. What I am doing is establishing many different connections, so that they all can communicate in the same way. I want an option to point to an object or any other, but I have to manage it through config.
That's why my problem is.
I am currently able to do this:
kernel.bund & lt; Interface name & gt; (). & Lt; ObjectName & gt; ();
< Code> kernal.Bind & LT; InterfaceName & gt; () & Lt; Properties.Settings.Default.ObjectName & gt; ();
This definitely does not work because it is trying to set some kind of asset.
That is what I am trying to do.
I have set the properties ObjectName then do the following.
type myType = Type.GetType (properties.Settings.Default.ObjectName); Kernal.bind & lt; InterfaceName & gt; () & Lt; MyType & gt; ();
I can not solve my type.
Please help.
No comments:
Post a Comment