Consider the following class
public class SchemaExecutor: ISchemaExecutor
{
public SchemaExecutor(SqlPlusSettings sqlPlusSettings)
{
_sqlPlusSettings = sqlPlusSettings;
}
...
And container configuration
ObjectFactory.Initialize( x =>
{
SqlPlusSettings sqlPlusSettings = GetSqlPlusSettings();
x.ForRequestedType<ISchemaExecutor>().TheDefaultIsConcreteType<SchemaExecutor>()
.WithCtorArg("sqlPlusSettings").EqualT(sqlPlusSettings);
});
But .WithCtorArg
works only for primitives and so the initialization above doesn't work.
Is there any way to configure constructor with non primitive parameter?