When using Dependency Injection with StructureMap, how can I iterate over multiple constructors?
I am trying to create a structmap to create a Fluent Nhibernate SessionSource
object for some of my tests in the field of internal registration. The only problem is that the concrete implementation ISessionSource
( SessionSource
) has 3 constructors:
public SessionSource(PersistenceModel model)
{
Initialize(new Configuration().Configure(), model);
}
public SessionSource(IDictionary<string, string> properties, PersistenceModel model)
{
Initialize(new Configuration().AddProperties(properties), model);
}
public SessionSource(FluentConfiguration config)
{
configuration = config.Configuration;
sessionFactory = config.BuildSessionFactory();
dialect = Dialect.GetDialect(configuration.Properties);
}
I tried to set up my ObjectFactory
to provide an argument for the first constructor, but it looks like it wants to try the second one.
How do I configure mine ObjectFactory
so that I can choose the first constructor, or perhaps another one if I choose to use it?
+2
a source to share