Using ninject/autofac for a given scenario
Posted
by sandesh247
on Stack Overflow
See other posts from Stack Overflow
or by sandesh247
Published on 2009-02-12T18:41:55Z
Indexed on
2010/05/18
3:00 UTC
Read the original article
Hit count: 365
I have some providers, say -
<Providers>
<Provider Type="Providers.IM" Name="Im"/>
<Provider Type="Providers.Web" Name="Web"/>
...
</Provider>
Each of these providers can give me a session :
<Sessions>
<Session Name="GoogleIM" Provider="Im" URL="..." />
<Session Name="YahooIM" Provider="Im" URL="..." />
<Session Name="YahooWeb" Provider="Web" URL="..." />
...
</Session>
Currently, I instantiate "named" sessions by looking at the provider, instantiating the type, and injecting the URL (manually).
I could use a session factory, which would probably have to understand the url and return a proper session.
Is there a way to handle this more elegantly/simply with ninject/autofac?
© Stack Overflow or respective owner