BarbarianIOC 简单的 IoC 容器

程序名称:BarbarianIOC

授权协议: CPOL

操作系统: Windows

开发语言: C#

BarbarianIOC 介绍

BarbarianIOC 是一个简单的 .NET 实现的 IoC 容器,示例代码

Container = new Container();
int someMockAge = 23; // this Could come from anywhere (App.Config / database etc etc)

//Register ALL components
container.RegisterComponents(
        //where you can use concrete type
        new Component().For<Foo>().WithInstanceMode(InstanceMode.Transient),
        //or you can use an interface and it's implementation
        new Component().For<IBaz>().ImplementedBy<Baz>().WithInstanceMode(InstanceMode.Transient),
        //and you can also declare singleton instance mode if you like
        new Component().For<SomeIBazDependantClass>().WithInstanceMode(InstanceMode.Singleton),
        //and even supply some non IOC provided constructor params by way of an anonymous object
        new Component().For<SomeFooDependantClass>()
            .DependsOn(new 
                { 
                    age=someMockAge
                })
            .WithInstanceMode(InstanceMode.Transient)
    );

//allow the container to wire stuff up (essentially create Expression.New for all 
//components to allow Container to compile and create some quicker lookup delegates)
container.WireUp();

BarbarianIOC 官网

http://www.codeproject.com/Articles/552514/BarbarianIOC-A-simple-IOC-Container

相关编程语言

BlazeDS 是一个基于服务器的Java 远程控制(remoting...
OVal 是一个可扩展的Java对象数据验证框架,验证的规...
Volta 是一套开发工具,专为开发分布式、实时系统应...
OpenDDS 是一个开源的 C++ 实现的 对象管理组织 OMG...
JADE (Java Agent DEvelopment Framework) 是一个完...
FastMM ,在D2006和2007中已代替了原来的内存管理器。