Why should I prefer StructureMap over Unity?

Why should I prefer StructureMap over Unity?

+3
source share
1 answer

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 Standard" automatically registers every type that has an interface with the same name and prefix "I". There are a few more built-in conventions (if you type names, don't follow this pattern), and it is trivial to define your own.

+6
source

Source: https://habr.com/ru/post/1764842/


All Articles