Why the need for a container and registering components?

Good day!

Began to study the full implementation of the WVVM pattern. Campaign study learned often use the library "PRISM"(began her study). The campaign study, "PRISM" has learned that implemented some containers. And that's actually the first a few questions: What is the container in this context and why is it needed? Also in this container for registration of dependencies. Here's a stream of questions: What kind of check dependencies and what does it do?

Here's an example:
public class Bootstrapper : AutofacBootstrapper
 protected override DependencyObject CreateShell() => Container.Resolve<Shell>();

 protected override void InitializeShell()

 Application.Current.MainWindow = (Window)Shell;

 protected override CreateContainerBuilder ContainerBuilder()
 var builder = new ContainerBuilder();

 // check the dependencies in the container
 // should be here...

 return builder;

  • What is the container?
  • What containers?
  • What is check dependencies?
  • Why to register dependencies?
  • Additional question(if you can answer) is there the significant difference between the IoC such as Unity, AUTOFAC, MEF?

Where I MOSTLY(but not all) about all this:
This series of articles

Thanks in advance.
April 4th 20 at 00:48
1 answer
April 4th 20 at 00:50
The container store dependencies. The container is used to resolve dependencies, those says which concrete implementation to substitute. You have a relationship can be an interface - class interface implementation, a class that inherits from a class, just class. So when you check you map type and its specific implementation.
For example
//The ViewModel Constructor
void RegisterViewModel(IRegisterService service)

So when the ioc container you request RegisterViewModel, he looks at the constructor parameters and in accordance with the types it was creates and inserts to the constructor of the appropriate types. Why is it necessary, you can change the implementation or to make some of the implementations and register them depending on the startup options or registry keys. In General, the inversion of dependencies is to rid the code of connectedness. In the example above, VM is not used in a particular class and a type described by the interface if you need to change the implementation, you change only the place of realization, and the class VM will remain unchanged. On smaller projects, maybe not a noticeable benefit, but in large, over which few people, even very.

Find more questions by tags WPFC#