I have the following component mapping in Windsor xml:
<component
id="dataSession.DbConnection"
service="System.Data.IDbConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
type="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
lifestyle="custom"
customLifestyleType="MyCompany.Castle.PerOperationLifestyle.PerOperationLifestyleManager, MyCompany.Castle">
<parameters>
<connectionString>server=(local);database=MyCompany;trusted_connection=true;application name=OperationScopeTest;</connectionString>
</parameters>
</component>
<component
id="dataSession.DataContext"
service="System.Data.Linq.DataContext, System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"
type="MyCompany.BusinessLogic.MyCompanyDataContext, MyCompany.BusinessLogic"
lifestyle="custom"
customLifestyleType="MyCompany.Castle.PerOperationLifestyle.PerOperationLifestyleManager, MyCompany.Castle">
<parameters>
<connection>${dataSession.DbConnection}</connection>
</parameters>
</component>
However, when I ask the container for a DataContext
, it actually uses the constructor requiring a connection string, despite the ${dataSession.DbConnection}
being an IDbConnection
.
Why is this, and how to I make Windsor use the correct constructor?