Common Service Locator的Unity适配器
2008-10-26 20:25
393 查看
Common Service Locator介绍
Common Service Locator 类库包含应用程序和框架开发者引用Service location共享的接口。这个类库提供了在IOC容器和Service locators之上抽象。使用这个类库允许一个应用程序在没有强引用依赖下间接的访问的能力。期望用这个类库,第三方应用程序和框架开始利用IOC/Service location改变在没有绑定他们到一个具体的实现。
这个项目包括所有验证过locator功能需求的具体实现测试套件。另外,在未来日子里项目中将包含几个流行IOC容器适配器程序。
Common Service Locator官方与下载
http://www.codeplex.com/CommonServiceLocator
接下来先来看一上适配器的代码:
config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="unity"
type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,Microsoft.Practices.Unity.Configuration, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<unity>
<typeAliases>
<!-- Lifetime manager types -->
<typeAlias alias="singleton"
type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager,
Microsoft.Practices.Unity" />
</typeAliases>
<containers>
<container>
<types>
<!-- Lifetime managers specified using the type aliases -->
<type type= "UnityAdapter.Tests.Components.ILogger, UnityAdapter.Tests"
mapTo="UnityAdapter.Tests.Components.SimpleLogger, UnityAdapter.Tests">
<lifetime type="singleton" />
</type>
<type type= "UnityAdapter.Tests.Components.ILogger, UnityAdapter.Tests" name="SimpleLogger"
mapTo="UnityAdapter.Tests.Components.SimpleLogger, UnityAdapter.Tests">
<lifetime type="singleton" />
</type>
<type type= "UnityAdapter.Tests.Components.ILogger, UnityAdapter.Tests" name="AdvancedLogger"
mapTo="UnityAdapter.Tests.Components.AdvancedLogger, UnityAdapter.Tests">
<lifetime type="singleton" />
</type>
</types>
</container>
</containers>
</unity>
</configuration>
相关引用:
Unity介绍
Unity Application Block (Unity)是一个轻量级的, 可扩展的依赖注入容器. 它有助于构建松耦合的应用程序和为开发者提供以下便利:
简化对象的创建,特别在分层对象结构和依赖的情形下
它支持需求的抽象化,这允许开发人员在运行时或在配置文件中指定依赖,简化横切关注点(crosscutting concerns)的管理
它通过把组件配置推给容器来决定,增加了灵活性
服务定位能力; 这使客户端能够存储或缓存容器
xUnit介绍
NUnit的创造者Jim Newkirk公布了一个新的单元测试框架,叫做xUnit.net。这个以NUnit接班人自许的新框架打算消除NUnit的错误和缺点,并打算在框架中加入一些最佳实践和扩展能力。
xUnit.net:下一代单元测试框架?
http://www.infoq.com/cn/news/2007/09/xunit-net
xUnit.net 项目官方
http://www.codeplex.com/xunit/
Common Service Locator 类库包含应用程序和框架开发者引用Service location共享的接口。这个类库提供了在IOC容器和Service locators之上抽象。使用这个类库允许一个应用程序在没有强引用依赖下间接的访问的能力。期望用这个类库,第三方应用程序和框架开始利用IOC/Service location改变在没有绑定他们到一个具体的实现。
这个项目包括所有验证过locator功能需求的具体实现测试套件。另外,在未来日子里项目中将包含几个流行IOC容器适配器程序。
Common Service Locator官方与下载
http://www.codeplex.com/CommonServiceLocator
接下来先来看一上适配器的代码:
config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="unity"
type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,Microsoft.Practices.Unity.Configuration, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<unity>
<typeAliases>
<!-- Lifetime manager types -->
<typeAlias alias="singleton"
type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager,
Microsoft.Practices.Unity" />
</typeAliases>
<containers>
<container>
<types>
<!-- Lifetime managers specified using the type aliases -->
<type type= "UnityAdapter.Tests.Components.ILogger, UnityAdapter.Tests"
mapTo="UnityAdapter.Tests.Components.SimpleLogger, UnityAdapter.Tests">
<lifetime type="singleton" />
</type>
<type type= "UnityAdapter.Tests.Components.ILogger, UnityAdapter.Tests" name="SimpleLogger"
mapTo="UnityAdapter.Tests.Components.SimpleLogger, UnityAdapter.Tests">
<lifetime type="singleton" />
</type>
<type type= "UnityAdapter.Tests.Components.ILogger, UnityAdapter.Tests" name="AdvancedLogger"
mapTo="UnityAdapter.Tests.Components.AdvancedLogger, UnityAdapter.Tests">
<lifetime type="singleton" />
</type>
</types>
</container>
</containers>
</unity>
</configuration>
相关引用:
Unity介绍
Unity Application Block (Unity)是一个轻量级的, 可扩展的依赖注入容器. 它有助于构建松耦合的应用程序和为开发者提供以下便利:
简化对象的创建,特别在分层对象结构和依赖的情形下
它支持需求的抽象化,这允许开发人员在运行时或在配置文件中指定依赖,简化横切关注点(crosscutting concerns)的管理
它通过把组件配置推给容器来决定,增加了灵活性
服务定位能力; 这使客户端能够存储或缓存容器
xUnit介绍
NUnit的创造者Jim Newkirk公布了一个新的单元测试框架,叫做xUnit.net。这个以NUnit接班人自许的新框架打算消除NUnit的错误和缺点,并打算在框架中加入一些最佳实践和扩展能力。
xUnit.net:下一代单元测试框架?
http://www.infoq.com/cn/news/2007/09/xunit-net
xUnit.net 项目官方
http://www.codeplex.com/xunit/
相关文章推荐
- Common Service Locator的Unity适配器
- Install-Package : “Unity”已拥有为“CommonServiceLocator”定义的依赖项。
- “Unity”已拥有为“CommonServiceLocator”定义的依赖项。
- Common Service Locator library
- .NET 服务器定位模式(Service Locator Pattern)——Common Service Locator
- Common Service Locator library
- 正在尝试解析依赖项“MvvmLightLibs (≥ 5.2.0.0)”。 “MvvmLightLibs”已拥有为“CommonServiceLocator”定义的依赖项
- Common Service Locator library
- 【IOC--Common Service Locator】不依赖于某个具体的IoC
- 正在尝试解析依赖项“MvvmLightLibs (≥ 5.2.0.0)”。 “MvvmLightLibs”已拥有为“CommonServiceLocator”定义的依赖项
- 【解决办法】MvvmLightLibs”已拥有为“CommonServiceLocator”定义的依赖项。 by:凉游浅笔深画眉 / Net7Cracker
- IoC的中繼器:CommonServiceLocator
- Common Service Locator
- 在Nuget管理器上安装MvvmLight框架,有时候会有如下提示: “MvvmLightLibs”已拥有为“CommonServiceLocator”定义的依赖项。
- “MvvmLightLibs”已拥有为“CommonServiceLocator”定义的依赖项。
- Common Service Locator library
- ServiceLocatorFactoryBean spring scope prototype
- HongHu云架构common-service构建流程
- [Design Pattern] Service Locator Pattern 简单案例