IoC/DI库 SimpleInjector
- 授权协议: MIT
- 开发语言: C# .NET
- 操作系统: Windows
- 软件首页: http://simpleinjector.codeplex.com
- 软件文档: http://simpleinjector.codeplex.com/documentation
软件介绍
SimpleInjector是一个基于.NET3.5的、简单易用的IoC/DI库。
SimpleInjector完全支持基于代码配置,对不太熟悉IoC/DI框架的开发人员是一种不错的选择。
使用
public class UserController : Controller
{
private readonly IUserRepository repository;
private readonly ILogger logger;
// Use constructor injection for the dependencies
public UserService(IUserRepository rep, ILogger logger)
{
this.repository = rep;
this.logger = logger;
}
// implement UserController methods here.
}
配置
protected void Application_Start(object sender, EventArgs e)
{
// 1. Create a new Simple Injector container
var container = new Container();
// 2. Configure the container (register)
container.Register();
container.RegisterSingle(() => new CompositeLogger(
container.GetInstance(),
container.GetInstance()
));
// 3. Optionally verify the container's configuration.
container.Verify();
// 4. Register the container as MVC3 IDependencyResolver.
DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
}
JavaScript修炼之道
波顿纽威 / 巩朋、张铁 / 人民邮电 / 2011-11 / 29.00元
《JavaScript修炼之道》是JavaScript的实战秘籍。作者将自己多年的编程经验融入其中,不仅可以作为学习之用,更是日常JavaScript开发中不可多得的参考手册,使读者少走很多弯路。《JavaScript修炼之道》的内容涵盖了当今流行的JavaScript库的运行机制,也提供了许多应用案例。《JavaScript修炼之道》针对各任务采取对页式编排,在对各任务的讲解中,左页解释了任务的......一起来看看 《JavaScript修炼之道》 这本书的介绍吧!
