For DI to work, you must have an interface whose concrete class you can inject into the consumer of the behavior you desire.
为了让DI工作,必须拥有一个接口,可以把这个接口的具体类注入到需要的行为的消费者中。
Many proponents of DI prefer constructor injection, because it means that the injected class never exists in a state where its dependencies aren't present.
许多DI的支持者愿意采用构造函数注入,因为这意味着注入的类永远不会出现依赖项不存在的情况。
With DI, you can allow the container to inject the appropriate customer class either by configuring the container or implementing the injection in the code.
使用DI,可以通过配置容器或在代码中实现注入,让容器注入适合的客户类。
They prefer that a class be totally ignorant of the DI framework.
他们更喜欢一个完全忽略DI框架的类。
The initialization code in Listing 2 is part of a class that uses setter injection for DI.
清单2中的初始化代码是一个类的一部分,它使用setter注入进行DI。
A service container is a class which helps you managing all these services (classes which have dependencies), without a container you can't have DI.
服务容器是一个类,可以帮助您管理所有这些服务(有依赖关系的类),没有一个容器,你不能有二。
DI enables you to inject objects into a class, instead of relying on the class to create the object itself.
DI使您能够将对象注入到类中,而不是依靠类来创建对象本身。
Why does this DI code declare a method-scope var and then assign it to a static, class-level object?
为什么这二代码声明一个方法范围变量并将其分配给一个静态的,类级别的对象?
The Di Zi Gui class for parents will be changed to every other Saturday afternoon, twice a month.
弟子规课程将改成隔周上课,每月两次。
Personal expertise can not be qualified for positions they bear. 3. Frail incompetent or performance as the C class Di.
身体衰弱,不能胜任工作的,或考绩列为丙等的。
Personal expertise can not be qualified for positions they bear. 3. Frail incompetent or performance as the C class Di.
身体衰弱,不能胜任工作的,或考绩列为丙等的。
应用推荐