Why should I prefer StructureMap over Unity?
+2
A:
StructureMap allows you to register your types by convention. Instead of explicitly registering Foo for IFoo, Bar for IBar, and Baz for IBaz, you can do:
ObjectFactory.Initialize(x =>
x.Scan(scan => {
scan.TheCurrentAssembly();
scan.WithDefaultConventions();
})
);
The "default convention" automatically registers every type that has an interface with the same name and the "I" prefix. There are a few other built-in conventions (if you type naming doesn't follow this pattern), and it is trivial to define your own.
Joshua Flanagan
2010-09-15 12:41:53
Is it the only reason?
Saghar
2010-09-15 13:13:32
No, it was just one of the more compelling reasons that most people would find useful. It is also much more mature than Unity. There are a number of features that Unity does not have, but repeating them all here would be like repeating the documentation. Hopefully a link will do http://structuremap.github.com/structuremap/
Joshua Flanagan
2010-09-15 21:53:06
Thanks Joshua Flanagan.
Saghar
2010-09-17 07:24:42