- 51Aspx源码必读.txt[3KB]
- from.gif[4KB]
- LightFactory.sln[2KB]
- LightFactory.suo[26KB]
- 最新Asp.Net源码下载.url[123B]
源码介绍
LightFactory轻量级注入框架源码
程序介绍
LightFactory非常快!
委托创建对象仅需要一个函数和一个if语句。LightFactory是非常高性能的依赖注入的框架。
LightFactory is extremely fast!
To invoke your object-generator delegate LightFactory used only 1 method call and check only 1 if-condition. Its make LightFactory one of the most high-performance Dependency Injection framework ever!
使用非常简单,看代码
public class Program
{
/// <summary>
/// STEP 1: Create you own factory which will inherit FactoryBase and provide type registration in InitTypes method.
/// </summary>
class SamplerFactory : FactoryBase
{
/// <summary>
/// STEP 2: Register new instance of you factory class with FactoryBase.RegisterFactory(...) call
/// </summary>
public override void InitFactory()
{
Define<ICollection<int>, int[]>(arr => new List<int>(arr));
}
}
public static void Main()
{
/// <summary>
/// STEP 3: Register SampleFactory instance before use it
/// </summary>
FactoryBase.RegisterFactory(new SamplerFactory());
/// <summary>
/// STEP 4: Use Factory<T>.Create() method and its overloads to create new instances.
/// </summary>
ICollection colletion = Factory<ICollection>.Create(new int[] { 1, 2, 3 });
}
}
下载记录(Only Recent 100)
用户名 | 推荐指数 | 下载时间 |
---|