Saturday, 15 September 2012

dependency injection - When using a DI framework, how does a new service know what other services are available? -



dependency injection - When using a DI framework, how does a new service know what other services are available? -

in big project using di framework (such ninject in case), options exist when implementing new "service" find out other "services" available used dependencies. before using di have noticed tendency in our code base of operations reference "god" object pretty much gave access available functionality , visual studio's intellisense become helpful find available (obviously approach possible because of poor architectural decisions of having such object in first place).

i can possible answers , interested has worked others:

you should know overall scheme working in plenty know other classes/services exist (for example, if had static classes have know exist able utilize them). you maintain external documentation of code base of operations classes/services understand developers (this imposes big documentation burden, seem me). create api query di container (ninject kernel) list of bindings see services available (perhaps singletons). done part of build scheme generate document automatically upon each build developers reference.

has ever been issue other developers?

usually don't want see services exist in scheme , take 1 of them. want access functionallity. construction classes namespaces in way obvious it.

e.g. if want know collections available in .net type system.collections.generic. , intellisense gives me list of options.

dependency-injection ninject ninject-2

No comments:

Post a Comment