源码论坛 | 淘宝店 |Tel:400-410-510(免长途)
我的浏览记录 |
| 帮助 ?


当前位置:首页 > 开发辅助 > LightFactory轻量级注入框架源码

前一源码

免费

LightFactory轻量级注入框架源码

[免费]

  • 浏览统计 累计:421 本月:65 本周:65  下载:107
  • 最后更新:2012-01-17 10:18:02

源码目录结构图

关键字: 工厂模式 轻量级 依赖注入

[编辑:WangXiaodong]

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 });
    }
}

 

相关商业代码

向前 切换 切换 切换 切换 向后

常见技术问题

综合讨论

下载前咨询(0人) | 下载后讨论(0)人

我要参与
还没人评论啊,赶快抢沙发...
上传者:capad

联系Ta?

分享者:
capad
身份:
普通用户
分享于
2012-01-17 10:18:02
通过率:
111/113=98%
热销商业源码
热销商业源码
热销商业源码

.NET开发常用工具

关于我们 | 加盟合作 | 广告服务 | 项目承接 | 一点一滴 | 联系我们 | 源码上传
联系电话(Tel):4000-410-510(免长途) 企业QQ:4000410510
地址:北京市石景山区万达广场F座十层 邮编:100040
Floor 10th,West Wanda Plaza,Shijingshan District,Beijing,100040,China
51Aspx.com 版权所有 CopyRight © 2006-2012. 京ICP备06046876号
在线客服
分享该页面
关闭侧边栏