I'm trying to get started with Structure Map. I'm using version 2.5.3.
I've built a simple boot strapper, but I can't get it to compile. I get the error:
'StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression' does not contain a definition for 'WithCtorArg' and no extension method 'WithCtorArg' accepting a first argument of type 'StructureMap.Configuration.DSL.Expressions.CreatePluginFamilyExpression' could be found (are you missing a using directive or an assembly reference?)
What's the am I missing?
the code I'm try to compile is here:
using DomainModel.Abstract;
using DomainModel.Concrete;
using StructureMap;
using StructureMap.Pipeline; //The only WithCtorArg methods I can find are in this namespace, it didn't help.
namespace WebUI
{
public class ContainerBootstrapper
{
public static void BootstrapStructureMap()
{
// Initialize the static ObjectFactory container
ObjectFactory.Initialize(x =>
{
x.ForRequestedType<IProductsRepository>()
.TheDefaultIsConcreteType<SqlProductsRepository>()
.WithCtorArg("connectionString")
.EqualToAppSetting("SqlConnection");
});
}
}
}