StructureMap is a Dependency Injection / Inversion of Control tool for .NET licensed under Apache 2. It can be found at http://structuremap.net
34
votes
2answers
12k views
Comparing Castle Windsor, Unity and StructureMap
In a follow up to Krzysztof’s statement that Windsor does a lot more than other IoC’s, I wanted to understand how these IoC’s stack up against each other and the benefits/additional facilities that ...
18
votes
4answers
4k views
StructureMap singleton usage (A class implementing two interface)
public interface IInterface1
{
}
public interface IInterface2
{
}
public class MyClass : IInterface1, IInterface2
{
}
...
ObjectFactory.Initialize(x =>
{
...
6
votes
3answers
4k views
StructureMap Auto registration for generic types using Scan
I've got an interface:
IRepository<T> where T : IEntity
while im knocking up my UI im using some fake repository implementations that just return any old data.
They look like this:
public ...
22
votes
2answers
6k views
Passing constructor arguments when using StructureMap
I'm using StructureMap for my DI. Imagine I have a class that takes 1 argument like:
public class ProductProvider : IProductProvider
{
public ProductProvider(string connectionString)
{
...
7
votes
4answers
4k views
IoC, Dll References, and Assembly Scanning
Although this question is related to StructureMap, my general question is:
When wiring up components with an IoC
container in code (as opposed
to configuring via xml) do you
generally need ...
11
votes
6answers
1k views
Ways of keeping configuration code out of logic code using Dependency Injection
How can keep all the configuration file code out of my logic code using Settings (ApplicationSettingsBase) and Dependency Injection?
With configuration I mean a customer specific configuration file.
...
12
votes
4answers
10k views
StructureMap : How to define default constructor by code?
I can't figure out how to define the default constructor (when it exists overloads) for a type in StructureMap (version 2.5) by code.
I want to get an instance of a service and the container has to ...
9
votes
3answers
4k views
NHibernate and Structure Map
So I really like working with NHibernate but always used Spring.Net with it.
I recently came across StructureMap by Jeremy Miller and really like it better than Spring.Net. On his StructureMap ...
8
votes
2answers
1k views
StructureMap IRegistrationConvention to register non default naming convention?
I currently have a bunch of repositories like so
IMyRepository
IAnotherRepository
They all inherit from IRepository (if this helps)
How can I get structuremap to use an IRegistryConvention scanner ...
5
votes
4answers
3k views
Strange behaviour with StructureMap / ASP.MVC / Visual Studio / LinqToSql
I have been using the new MVC framework with StructureMap recently and have had good results overall, however, I keep running into a very strange error that I cannot understand or work out how to ...
3
votes
3answers
1k views
IQueryable Repository with StructureMap (IoC) - How do i Implement IDisposable?
If i have the following Repository:
public IQueryable<User> Users()
{
var db = new SqlDataContext();
return db.Users;
}
I understand that the connection is opened only when the query ...
1
vote
3answers
887 views
Can I replace the call to Activator.CreateInstance() in NHibernate?
Is there a way to replace the call to Activator.CreateInstance() used inside NHibernate 2.0.1GA to construct the entities? Ideally I'd like to replace it with ...
7
votes
2answers
1k views
Xml configuration or Configuration through code?
I personally like the option to configure StructureMap from C# code. From what I understand, one of the advantages of DI, is that we can easily swap in a new concrete instance. But, if the ...
8
votes
4answers
3k views
Using structuremap with log4net wrapper
I have the following interface:
public interface ILogger
{
void Debug(string message, params object[] values);
void Info(string message, params object[] values);
void Warn(string message, ...
8
votes
3answers
3k views
How to scan and auto-configure profiles in AutoMapper?
Is there any way to auto-configue Automapper to scan for all profiles in namespace/assembly? What I would like to do is to add mapping profiles to AutoMapper from given assembly filtered by given ...