My code is as follows:
IComponentsConfig config =
System.Configuration.ConfigurationManager.GetSection("components") as
IComponentsConfig;
INamedServiceProvider srv = ((INamedServiceProvider) new
ServiceProvider(config));
((IMyInterfaceName)srv.GetService("MyObjectName")).MyMethodName();
All is want from a configuration standpoint is a way to get a
reference to my service object/type I'm not sure which factory to use
in my config file. (e.g. StaticPropertyInvokingFactory or
MethodInvokingFactory, etc...) I'll then cast the returned object to
an interface i've defined and invoke a method on it. Seems simple but
like i said, i'm new to IOC containers. Can u tell me how my
configuration should work ?
thanks in advance.
Note that you shouldn't use special factory classes like
StaticPropertyInvokingFactory and MethodInvokingFactory for defining
usual component instance (re these classes, they are used for
delegating component instance creation to external factories).
So what i have in my config (after reading your reponse) is as
follows:
<components>
<component name="SSISPackage" type="EDIS.SSIS.SSISPackage,
EDIS_SSISPackage" singleton="true">
</component>
</components>
where
-"SSISPackage" is the value i use in the GetService("SSISPackage)
call.
-EDIS.SSIS.SSISPackage is the fully qualified reference to my object
-EDIS_SSISPackage is the name of my assembly file referenced in my
project (EDIS_SSISPackage.dll)
Does this look correct ?
thank you again...
On Apr 14, 10:45 am, Vitalik <fedorche...@gmail.com> wrote:
> You can simply define your instance as following (in "components"
> section of your app.config file, seehttp://code.google.com/p/nicnet/source/browse/trunk/examples/NI.Examp...