Enterprise Library Unity简介

The Unity Application Block (Unity) is a lightweight extensible dependency injection container with support for constructor, property, and method call injection.

Unity 是一个轻量级可扩展依赖注入容器,支持构造方法、属性和方法。

 

Unity addresses the issues faced by developers engaged in component-based software engineering. Modern business applications consist of custom business objects and components that perform specific or generic tasks within the application, in addition to components that individually address cross cutting concerns such as logging, authentication, authorization, caching, and exception handling.
Unity 解决了开发人员在做基于组件的软件工程的时候遇到的问题。现代的业务应用程序由客户端业务对象,执行特定或一类任务的组件,加上一些独立处理关联的概念,比如日志、登录认证、授权、缓存和错误处理。


The key to successfully building such applications is to achieve a decoupled or very loosely coupled design. Loosely coupled applications are more flexible and easier to maintain. They are also easier to test during development. You can mock up shims (lightweight mock implementations) of objects that have strong concrete dependencies; such as database connections, network connections, ERP connections, and rich user interface components.
开发这种应用程序的关键是解耦或者松耦合的设计。松耦合的应用程序更加灵活和易于维护,同时开发当中更容易测试。你可以模拟(轻量的模拟实现)强依赖关系对象的部分,比如数据库连接、网络连接、ERP 连接和富用户接口组件。


Dependency injection is a prime technique for building loosely coupled applications. It provides ways to handle the dependencies between objects. For example, an object that processes customer information may depend on other objects that access the data store, validate the information, and check that the user is authorized to perform updates. Dependency injection techniques can ensure that the customer class correctly instantiates and populates all of these objects, especially where the dependencies may be abstract.

依赖注入是创建松耦合应用程序的主要技术。它提供了处理对象关系的方法。例如,一个对象处理客户的信息可能依靠其它数据访问、信息有效性验证、判断用户是否有权限执行更新的对象。依赖注入技术可以保证用户对象被正确的实例化,并且在复杂关系的时候可以生成所需要的对象。

 

IoC(Inverse of Control)控制反转。 Java 开发中, IoC 意味着将你设计好的类交给系统去控制,而不是在你的类内部控制。这称为控制反转。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值