views:

130

answers:

2

Hi everybody!

I'm trying to implement this scenario using Unity and i can't figure out how this could be done:

the same web application (ASP.NET MVC) should be made accessible to more than one client (multi-tenant). The URL of the web site will differentiate the client (this i know how to get).

So getting the URL one could set the (let's call it) IConnectionStringProvider parameter (which will be afterward injected into IRepository and so on). Through which mechanism (using Unity) do i set the IConnectionStringProvider parameter at run time?

I have done this in the past using Windsor & IHandlerSelector (see this) but it's my first attempt using Unity.

Any help is deeply appreciated! Thanks in advance

A: 

Finally i did what Krzysztof Koźmic suggested. See this for a solution.

Savvas Sopiadis
A: 

You can hard code parameters in Unity config, but you can't dynamically inject them at run time. I believe this is coming in Unity 2.0, have you had a look at the Beta?

John Mc