When using Dependency Injection with StructureMap how do I chooose among multiple constructors?
Posted
by Mark Rogers
on Stack Overflow
See other posts from Stack Overflow
or by Mark Rogers
Published on 2010-04-25T17:45:25Z
Indexed on
2010/04/25
17:53 UTC
Read the original article
Hit count: 225
I'm trying to get structuremap to build Fluent Nhibernate's SessionSource
object for some of my intregration tests. The only problem is that Fluent's concrete implementation of 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've tried configuring my ObjectFactory
supplying an argument for the first constructor but it seems like it wants to try the second one.
How do I configure my ObjectFactory
so that I can choose the first constructor or perhaps even another one if I decide to use that?
© Stack Overflow or respective owner