Ninject modules or wiring dependency organization

I started playing with Ninject and with a screencast that says you configured the binding:

class MyModule : StandardModule {

    public override void Load() {
        Bind<IInterface>().To<ConcreteType>();
        // More bindings here...
    }
}

All this is very good.

However, suppose you have one hundred objects used in the application. This means that it will have a hundred bindings. Is it correct?

Secondly, I believe that with such an application it can be divided into subsystems such as GUI, Database, Services, etc.

I would create a user module for each subsystem, which in turn would be as follows:

  • GUIModule
  • DatabaseModule
  • Servicemodule
  • ...

For each module, you must have the necessary bindings. Am I here on the right page?

Finally, will this binding be done at Mainor at the entry point for your application?

+3
1

, , . , . ?

, , . Ninject, . . .

, . ( -) .

.

"" ( , , ), . ( ) ( )

, Main ?

, . .

+4

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


All Articles