I have a common interface:
public interface IRepository<T> { ... }
I have an implementation like this:
public class Repository<T> {
public Repository<T>() { ... }
}
StructureMap (v 2.6.3) is configured as follows:
For(typeof(IRepository<>)).Use(typeof(Repository<>));
When I try to pull IRepository<Something>from StructureMap, I get Repository<Something>as expected. Hooray!
Now I have added a second constructor, and the implementation looks like this:
public class Repository<T> {
public Repository<T>() { ... }
public Repository<T>(string database) { ... }
}
When I try to get IRepository<Something>now, I get an exception, because by default it tries to use the new constructor with a parameter. Boo!
How do I reconfigure StructureMap so that it knows what to use the constructor without parameters?
Neild source
share